def test_has_at_after_command(self): '''Tests expressions with '@' e.g 'create @xyz' ''' tokens = 'create @xyz'.split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, { 'member': '', 'group': 'xyz', 'extras': '', 'command': 'create' })
def test_starts_with_groupname(self): '''Tests expressions starting with group name '@' e.g 'xyz leave' ''' tokens = 'xyz leave'.split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, { 'member': '', 'group': 'xyz', 'extras': '', 'command': 'leave' })
def test_has_group_keyword(self): '''Tests existence of 'group' in command 'e.g 'join group xyz' ''' tokens = 'join group xyz'.split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, { 'member': '', 'group': 'xyz', 'extras': '', 'command': 'join' })
def test_starts_with_at(self): '''Tests expressions starting with '@' e.g '@xyz create' ''' tokens = '@xyz create'.split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, { 'member': '', 'group': 'xyz', 'extras': '', 'command': 'create' })
def test_join_with_username(self): '''Tests joining with username provided''' tokens = 'join xyz as member1'.split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, { 'member': 'member1', 'group': 'xyz', 'extras': '', 'command': 'join' })
def test_has_to_keyword(self): '''Tests expressions that have from keyword e.g. invite member1 to xyz''' tokens = 'invite member1 to xyz'.split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, { 'member': 'member1', 'group': 'xyz', 'extras': '', 'command': 'invite' })
def test_has_user(self): '''Tests expressions that specify user '@' e.g 'delete user_a@xyz' ''' tokens = 'delete user_a@xyz'.split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, { 'member': 'user_a', 'group': 'xyz', 'extras': '', 'command': 'delete' })
def test_has_group_keyword(self): """Tests existence of 'group' in command 'e.g 'invite group xyz member_a' """ tokens = "invite group xyz member_a".split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, {"member": "member_a", "group": "xyz", "extras": "", "command": "invite"})
def test_starts_with_at(self): """Tests expressions starting with '@' e.g '@xyz remove member_a' """ tokens = "@xyz remove member_a".split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, {"member": "member_a", "group": "xyz", "extras": "", "command": "remove"})
def test_has_user(self): """Tests expressions that specify user '@' e.g 'delete user_a@xyz' """ tokens = "delete user_a@xyz".split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, {"member": "user_a", "group": "xyz", "extras": "", "command": "delete"})
def test_starts_with_groupname(self): """Tests expressions starting with group name '@' e.g 'xyz leave' """ tokens = "xyz leave".split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, {"member": "", "group": "xyz", "extras": "", "command": "leave"})
def test_has_at_after_command(self): """Tests expressions with '@' e.g 'create @xyz' """ tokens = "create @xyz".split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, {"member": "", "group": "xyz", "extras": "", "command": "create"})
def test_join_with_username(self): """Tests joining with username provided""" tokens = "join xyz as member1".split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, {"member": "member1", "group": "xyz", "extras": "", "command": "join"})
def test_has_to_keyword(self): """Tests expressions that have from keyword e.g. invite member1 to xyz""" tokens = "invite member1 to xyz".split() result = grammar.parse(tokens, self.lang) self.assertEqual(result, {"member": "member1", "group": "xyz", "extras": "", "command": "invite"})