Пример #1
0
 def test_add_entity(self):
     processor = MongoProcessor()
     assert processor.add_entity("file_text", "tests", "testUser") == None
     slots = Slots.objects(bot="tests")
     new_slot = slots.get(name="file_text")
     enitity = Entities.objects(bot="tests").get(name="file_text")
     assert slots.__len__() == 3
     assert new_slot.name == "file_text"
     assert new_slot.type == "text"
     assert enitity.name == "file_text"
Пример #2
0
 def test_add_blank_entity(self):
     processor = MongoProcessor()
     with pytest.raises(ValidationError):
         processor.add_entity("  ", "tests", "testUser")
Пример #3
0
 def test_add_entity_duplicate(self):
     processor = MongoProcessor()
     with pytest.raises(Exception):
         assert processor.add_entity("file_text", "tests", "testUser")
Пример #4
0
 def test_add_empty_entity(self):
     processor = MongoProcessor()
     with pytest.raises(AssertionError):
         processor.add_entity("", "tests", "testUser")