~jonas-drange/ubuntu-push/lp1577723-skiptest

« back to all changes in this revision

Viewing changes to client/client_test.go

  • Committer: Guillermo Gonzalez
  • Date: 2014-08-04 20:40:50 UTC
  • mto: This revision was merged to the branch mainline in revision 293.
  • Revision ID: guillermo.gonzalez@canonical.com-20140804204050-0tbj2xmmy6cs9a6u
replace whoopsie with /var/lib/dbus/machine-id

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        "launchpad.net/ubuntu-push/client/session"
43
43
        "launchpad.net/ubuntu-push/client/session/seenstate"
44
44
        "launchpad.net/ubuntu-push/config"
 
45
        "launchpad.net/ubuntu-push/identifier"
 
46
        idtesting "launchpad.net/ubuntu-push/identifier/testing"
45
47
        "launchpad.net/ubuntu-push/protocol"
46
48
        helpers "launchpad.net/ubuntu-push/testing"
47
49
        "launchpad.net/ubuntu-push/testing/condition"
48
50
        "launchpad.net/ubuntu-push/util"
49
 
        "launchpad.net/ubuntu-push/whoopsie/identifier"
50
 
        idtesting "launchpad.net/ubuntu-push/whoopsie/identifier/testing"
51
51
)
52
52
 
53
53
func TestClient(t *testing.T) { TestingT(t) }
239
239
        c.Check(cli.idder, IsNil)
240
240
        err := cli.configure()
241
241
        c.Assert(err, IsNil)
242
 
        c.Assert(cli.idder, FitsTypeOf, identifier.New())
 
242
        newIdder, err := identifier.New()
 
243
        c.Assert(cli.idder, FitsTypeOf, newIdder)
243
244
}
244
245
 
245
246
func (cs *clientSuite) TestConfigureSetsUpEndpoints(c *C) {
536
537
func (cs *clientSuite) TestGetDeviceIdWorks(c *C) {
537
538
        cli := NewPushClient(cs.configPath, cs.leveldbPath)
538
539
        cli.log = cs.log
539
 
        cli.idder = identifier.New()
 
540
        cli.idder, _ = identifier.New()
540
541
        c.Check(cli.deviceId, Equals, "")
541
542
        c.Check(cli.getDeviceId(), IsNil)
542
543
        c.Check(cli.deviceId, HasLen, 40)
550
551
        c.Check(cli.getDeviceId(), NotNil)
551
552
}
552
553
 
553
 
func (cs *clientSuite) TestGetDeviceIdWhoopsieDoesTheUnexpected(c *C) {
 
554
func (cs *clientSuite) TestGetDeviceIdIdentifierDoesTheUnexpected(c *C) {
554
555
        cli := NewPushClient(cs.configPath, cs.leveldbPath)
555
556
        cli.log = cs.log
556
557
        settable := idtesting.Settable()
557
558
        cli.idder = settable
558
559
        settable.Set("not-hex")
559
560
        c.Check(cli.deviceId, Equals, "")
560
 
        c.Check(cli.getDeviceId(), ErrorMatches, "whoopsie id should be hex: .*")
 
561
        c.Check(cli.getDeviceId(), ErrorMatches, "machine-id should be hex: .*")
561
562
}
562
563
 
563
564
/*****************************************************************
1111
1112
        // and now everthing is better! We have a config,
1112
1113
        c.Check(string(cli.config.Addr), Equals, ":0")
1113
1114
        // and a device id,
1114
 
        c.Check(cli.deviceId, HasLen, 40)
 
1115
        c.Check(cli.deviceId, HasLen, 32)
1115
1116
        // and a session,
1116
1117
        c.Check(cli.session, NotNil)
1117
1118
        // and a bus,