def test_no_setting(self): h = HipChat(nick='Sarah', jid='test@localhost', password='******', plugins=()) with patch.object(h.client.plugin['xep_0045'].xmpp, 'send', return_value=None) as mock_send: h.join_rooms({}) assert_that(mock_send.call_count).is_zero() assert_that(h.client.plugin['xep_0045']) \ .has_rooms({}) \ .has_ourNicks({})
def test_success(self): h = HipChat(nick='Sarah', jid='test@localhost', rooms=['123_homer@localhost'], password='******', plugins=()) with patch.object(h.client.plugin['xep_0045'].xmpp, 'send', return_value=None) as mock_send: h.join_rooms({}) assert_that(mock_send.call_count).is_equal_to(1) assert_that(h.client.plugin['xep_0045']) \ .has_rooms({'123_homer@localhost': {}}) \ .has_ourNicks({'123_homer@localhost': h.nick})