Esempio n. 1
0
 def test_save(self):
     from core.Index import Index
     from core.Base import Base
     my_type = str(uuid.uuid4())
     field = str(uuid.uuid4())
     values = [str(uuid.uuid4()), str(uuid.uuid4()), str(uuid.uuid4())]
     index = Index(my_type, field, values)
     index.save()
     ast = Base().get_all(Index.collection, {})
     assert ast.count() == 1
     assert ast[0]['type'] == my_type
     assert ast[0]['field'] == field
     assert ast[0]['values'] == values
     index2 = Index(my_type, field)
     assert index2._values == None
     index2 = index2.get()
     assert index2._values == values