예제 #1
0
 def test_init(self):
     # required to clear listeners of dependency
     run_coroutine(self.s.shutdown())
     s = roster_service.RosterClient(self.cc,
                                     dependencies=self.dependencies)
     self.assertDictEqual({}, s.items)
     self.assertEqual(None, s.version)
     self.assertDictEqual({}, s.groups)
예제 #2
0
    def setUp(self):
        self.cc = make_connected_client()
        self.presence_dispatcher = aioxmpp.dispatcher.SimplePresenceDispatcher(
            self.cc)
        self.dependencies = {
            aioxmpp.dispatcher.SimplePresenceDispatcher:
            self.presence_dispatcher,
        }
        self.s = roster_service.RosterClient(self.cc,
                                             dependencies=self.dependencies)

        self.user1 = structs.JID.fromstr("*****@*****.**")
        self.user2 = structs.JID.fromstr("*****@*****.**")

        response = roster_xso.Query(items=[
            roster_xso.Item(jid=self.user1,
                            groups=[
                                roster_xso.Group(name="group1"),
                                roster_xso.Group(name="group3"),
                            ]),
            roster_xso.Item(jid=self.user2,
                            name="some bar user",
                            subscription="both",
                            groups=[
                                roster_xso.Group(name="group1"),
                                roster_xso.Group(name="group2"),
                            ])
        ],
                                    ver="foobar")

        self.cc.send.return_value = response

        run_coroutine(self.cc.before_stream_established())

        self.cc.send.reset_mock()

        self.listener = make_listener(self.s)