Exemplo n.º 1
0
 def test_add_blank_intent(self):
     processor = MongoProcessor()
     with pytest.raises(ValidationError):
         processor.add_intent("  ", "tests", "testUser")
Exemplo n.º 2
0
 def test_add_intent(self):
     processor = MongoProcessor()
     assert processor.add_intent("greeting", "tests", "testUser")
     intent = Intents.objects(bot="tests").get(name="greeting")
     assert intent.name == "greeting"
Exemplo n.º 3
0
 def test_add_intent_duplicate(self):
     processor = MongoProcessor()
     with pytest.raises(Exception):
         processor.add_intent("greeting", "tests", "testUser")
Exemplo n.º 4
0
 def test_add_empty_intent(self):
     processor = MongoProcessor()
     with pytest.raises(AssertionError):
         processor.add_intent("", "tests", "testUser")
Exemplo n.º 5
0
 def test_add_intent_special_character(self):
     processor = MongoProcessor()
     with pytest.raises(ValidationError):
         assert processor.add_intent("// ** Wootness * //", "tests",
                                     "testUser")
Exemplo n.º 6
0
 def test_add_intent_with_hypen(self):
     processor = MongoProcessor()
     with pytest.raises(ValidationError):
         assert processor.add_intent("greeting-examples", "tests",
                                     "testUser")
Exemplo n.º 7
0
 def test_add_intent_with_underscore(self):
     processor = MongoProcessor()
     assert processor.add_intent("greeting_examples", "tests", "testUser")
     intent = Intents.objects(bot="tests").get(name="greeting_examples")
     assert intent.name == "greeting_examples"