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