def test_parse_global_mod(self): self.tags['user-type'] = 'global_mod' userstate.parse(self.channel, self.tags) self.assertIs(self.mock_globals.isTwitchStaff, False) self.assertIs(self.mock_globals.isTwitchAdmin, False) self.assertIs(self.mock_globals.isGlobalMod, True) self.assertIs(self.channel.isMod, True) self.assertIs(self.channel.isSubscriber, False)
def test_parse(self): userstate.parse(self.channel, self.tags) self.assertEqual(self.mock_globals.displayName, 'BotGotsThis') self.assertIs(self.mock_globals.isTwitchStaff, False) self.assertIs(self.mock_globals.isTwitchAdmin, False) self.assertIs(self.mock_globals.isGlobalMod, False) self.assertIs(self.channel.isMod, False) self.assertIs(self.channel.isSubscriber, False)
def test_parse_channel_none(self): self.tags['user-type'] = 'staff' userstate.parse(None, self.tags) self.assertEqual(self.mock_globals.displayName, 'BotGotsThis') self.assertIs(self.mock_globals.isTwitchStaff, True) self.assertIs(self.mock_globals.isTwitchAdmin, True) self.assertIs(self.mock_globals.isGlobalMod, True) self.assertIs(self.channel.isMod, False) self.assertIs(self.channel.isSubscriber, False)
def test_parse_emote_sets_empty(self): del self.tags['emote-sets'] userstate.parse(self.channel, self.tags) self.assertFalse(self.mock_handle_emote.called)
def test_parse_emote_sets_turbo_special(self): self.tags['emote-sets'] = '0,33,42' userstate.parse(self.channel, self.tags) self.mock_handle_emote.assert_called_once_with({0})
def test_parse_emote_sets_changed(self): self.tags['emote-sets'] = '0,1' userstate.parse(self.channel, self.tags) self.mock_handle_emote.assert_called_once_with({0, 1})
def test_parse_subscriber(self): self.tags['subscriber'] = '1' userstate.parse(self.channel, self.tags) self.assertIs(self.channel.isSubscriber, True)
def test_parse_tags_none(self): userstate.parse(self.channel, None)