def setUp(self): # Reuse setup, without being subclass and pulling in tests DexterCommandTester.setUp(self) self.j_loc = ["local", None, "jackson"] self.t_loc = ["local", None, "tealc"] self.interface.data = { "identity": self.j_loc, "idcache": { '["local",null,"jackson"]': { "location": self.j_loc, "name": "*****@*****.**", "encryptor": ["rotate", 4], }, '["local",null,"tealc"]': {"location": self.t_loc, "name": "*****@*****.**", "encryptor": ["rotate", 5]}, }, "docname": "example", "docserialized": handler_document("echo_chamber").serialize(), } with self.io: self.interface.do_command("dinit") self.router = self.interface.owner.router self.tealc = Client(self.router, self.t_loc, self.interface.owner.identities) self.daniel = self.interface.owner.client
def setUp(self): StreamTest.setUp(self) self.router = Router() self.mitzi = Owner(identity("mitzi"), self.router) self.atlas = Owner(identity("atlas"), self.router) self.victor = Owner(identity("victor"), self.router) self.mitzi.identities.sync(self.atlas.identities, self.victor.identities) # Document that mitzi and atlas are part of, but victor is not. # Separate identical starting points for all of them. self.mdoc = handler_document("tag_team") self.adoc = handler_document("tag_team") self.vdoc = handler_document("tag_team") self.mitzi.own_document(self.mdoc) self.atlas.own_document(self.adoc) self.victor.own_document(self.vdoc)
def setUp(self): self.doc = handler_document('echo_chamber') self.ident = identity() self.ev = Event({'x':'y'}, self.ident, 'stormageddon') self.quorum = Quorum(self.ev, self.doc._qs) self.owner = Owner(self.ident, make_jack=False) self.owner.own_document(self.doc) self.io = IOMock()
def setUp(self): StreamTest.setUp(self) self.doc = handler_document("echo_chamber") self.ev = Event({'x':'y'}, identity("atlas"), self.doc.version) self.quorum = Quorum(self.ev, self.doc._qs) self.quorum.document = self.doc self.ident = identity() self.owner = Owner(self.ident, make_jack=False) self.owner.own_document(self.doc) self.owner.identities.update_ident(self.ev.author)
def setUp(self): StreamTest.setUp(self) self.doc = handler_document(self.name) self.identity = Identity( "*****@*****.**", ['rotate',5], ['local', None, "kirk"] ) self.owner = Owner(self.identity, make_jack = False) self.owner.own_document(self.doc)
def test_init(self): # Do setup for testing a good owner. owner = Owner(identity(), make_jack = False) key = String('["local",null,"mitzi"]') self.assertIsInstance(owner.identities, IdentityCache) self.assertIn(key, owner.identities) self.assertIsInstance(owner.identities[key], Identity) doc = handler_document("echo_chamber") self.assertIsInstance(doc.handler, Resource) owner.own_document(doc)
def setUp(self): self.doc = handler_document("tag_team") self.qs = self.doc._qs self.mitzi = identity('mitzi') self.atlas = identity('atlas') self.ev1 = Event({"hello":"world"}, self.mitzi, self.doc.version) self.ev2 = Event({"turtle":"food"}, self.mitzi, self.doc.version) self.q1 = Quorum(self.ev1, self.qs) self.q2 = Quorum(self.ev2, self.qs) self.owner = Owner(self.mitzi, make_jack=False) self.owner.own_document(self.doc) self.owner.identities.update_ident(self.atlas)
def test_dinit_success(self): location = ["local", None, "jackson"] docserial = handler_document("echo_chamber").serialize() self.interface.data = { "identity": location, "idcache": { '["local",null,"jackson"]': {"location": location, "name": "*****@*****.**", "encryptor": ["rotate", 4]} }, "docname": "example", "docserialized": docserial, } with self.io: self.interface.do_command("dinit") self.assertEqual(self.interface.view.contents, ["msglog> dinit", "DEJE initialized"]) self.assertIsInstance(self.interface.owner, Owner) self.assertEqual(self.interface.owner.identity, self.interface.owner.identities.find_by_location(location)) self.assertIsInstance(self.interface.document, Document) self.assertEqual(self.interface.document.name, "example") self.assertEqual(self.interface.document.serialize(), docserial)