示例#1
0
 def test_unrecognized_command_substring(self):
     query = BotQuery()
     query.message = "/starts"
     result = CommandParser.parse_command(query)
     self.assertIsInstance(result, InvalidCommand)
示例#2
0
 def test_not_a_command(self):
     query = BotQuery()
     query.message = "hello there"
     result = CommandParser.parse_command(query)
     self.assertIsInstance(result, InvalidCommand)
示例#3
0
 def test_none(self):
     query = BotQuery()
     query.message = None
     result = CommandParser.parse_command(query)
     self.assertIsInstance(result, InvalidCommand)
示例#4
0
 def test_empty_string(self):
     query = BotQuery()
     query.message = ""
     result = CommandParser.parse_command(query)
     self.assertIsInstance(result, InvalidCommand)
示例#5
0
 def test_trends_command(self):
     query = BotQuery()
     query.message = " /Trends "
     result = CommandParser.parse_command(query)
     self.assertIsInstance(result, TrendsCommand)
     self.assertIs(query, result.query)
示例#6
0
 def test_fact_command(self):
     query = BotQuery()
     query.message = " /FACT     "
     result = CommandParser.parse_command(query)
     self.assertIsInstance(result, FactCommand)
     self.assertIs(query, result.query)
示例#7
0
 def test_joke_command(self):
     query = BotQuery()
     query.message = "/JOke 1234"
     result = CommandParser.parse_command(query)
     self.assertIsInstance(result, JokeCommand)
     self.assertIs(query, result.query)
示例#8
0
 def test_help_command(self):
     query = BotQuery()
     query.message = " /help me"
     result = CommandParser.parse_command(query)
     self.assertIsInstance(result, HelpCommand)
     self.assertIs(query, result.query)
示例#9
0
 def test_start_command(self):
     query = BotQuery()
     query.message = " /start 123 "
     result = CommandParser.parse_command(query)
     self.assertIsInstance(result, StartCommand)
     self.assertIs(query, result.query)