Example #1
0
 def test_add_blank_intent(self):
     processor = MongoProcessor()
     with pytest.raises(ValidationError):
         processor.add_intent("  ", "tests", "testUser")
Example #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"
Example #3
0
 def test_add_intent_duplicate(self):
     processor = MongoProcessor()
     with pytest.raises(Exception):
         processor.add_intent("greeting", "tests", "testUser")
Example #4
0
 def test_add_empty_intent(self):
     processor = MongoProcessor()
     with pytest.raises(AssertionError):
         processor.add_intent("", "tests", "testUser")
Example #5
0
 def test_add_intent_special_character(self):
     processor = MongoProcessor()
     with pytest.raises(ValidationError):
         assert processor.add_intent("// ** Wootness * //", "tests",
                                     "testUser")
Example #6
0
 def test_add_intent_with_hypen(self):
     processor = MongoProcessor()
     with pytest.raises(ValidationError):
         assert processor.add_intent("greeting-examples", "tests",
                                     "testUser")
Example #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"