def test_offer_mailbox(self):
        nA, nB = self.make_nodes(transport="none")
        self.failUnlessEqual(len(nA.agent.get_transports()), 0)
        d = self.add_new_channel_with_invitation(nA, nB, offer_mailbox=True,
                                                 accept_mailbox_offer=True)
        def _then((entA,entB)):
            self.failUnlessEqual(entA["their_verfkey"], entB["my_verfkey"])
            self.failUnlessEqual(entB["their_verfkey"], entA["my_verfkey"])
            st = fetchone(nB.db, "mailbox_server_transports")
            sj = fetchone(nB.db, "mailbox_server_config")
            s = json.loads(sj["mailbox_config_json"])
            r_privkey = PrivateKey(s["retrieval_privkey"].decode("hex"))
            r_pubkey = r_privkey.public_key.encode().encode("hex")
            t_privkey = PrivateKey(s["transport_privkey"].decode("hex"))
            t_pubkey = t_privkey.public_key.encode().encode("hex")

            transports = nA.agent.get_transports()
            self.failUnlessEqual(len(transports), 1)
            self.failUnless(transports in 1)
            t1 = transports[1]["transport"]
            self.failUnlessEqual(t1["generic"]["type"], "http")
            self.failUnlessEqual(t1["generic"]["url"], nB.baseurl+"mailbox")
            self.failUnlessEqual(t1["generic"]["transport_pubkey"], t_pubkey)
            self.failUnlessIn("TT0", t1["sender"])
            # TODO: when RRID crypto is done, check TT0 better

            r = transports[1]["retrieval"]
            self.failUnlessEqual(r["type"], "http")
            self.failUnlessEqual(r["baseurl"], nB.baseurl+"retrieval/")
            self.failUnlessEqual(r["RT"], st["RT"])
            self.failUnlessEqual(r["retrieval_pubkey"], r_pubkey)
            self.failUnlessEqual(r["retrieval_symkey"], st["symkey"])

            retrievers = nA.agent.mailbox_retrievers
            self.failUnlessEqual(len(retrievers), 1)
            self.failUnless(isinstance(list(retrievers)[0], HTTPRetriever))
            return nA.disownServiceParent()
        d.addCallback(_then)
        d.addCallback(lambda _: self.startNode(nA.basedir))
        def _then2(nA2):
            retrievers = nA2.agent.mailbox_retrievers
            self.failUnlessEqual(len(retrievers), 1)
            self.failUnless(isinstance(list(retrievers)[0], HTTPRetriever))
        d.addCallback(_then2)

        return d
dataset/ETHPy150Open warner/petmail/petmail/test/test_mailbox.py/Invite.test_offer_mailbox/swapped operands of `in`