def test_get_all(self): from core.TestType import TestType from core.Base import Base my_type1 = str(uuid.uuid4()) doc1 = [str(uuid.uuid4()), str(uuid.uuid4()), str(uuid.uuid4())] test_type1 = TestType(my_type1, doc1) test_type1.save() my_type2 = str(uuid.uuid4()) doc2 = [str(uuid.uuid4()), str(uuid.uuid4()), str(uuid.uuid4())] test_type2 = TestType(my_type2, doc2) test_type2.save() types = TestType.get_all() assert len(types) == 2 types = TestType.get_all({TestType._test_type: my_type2}) assert len(types) == 1 assert types[0]._doc_fields == doc2 types = TestType.get_all(query_filter={TestType._test_type: my_type1}) assert len(types) == 1 assert types[0]._doc_fields == doc1
def get(self): test_types = TestTypeCore.get_all() test_types = [prep_test_type(test_type) for test_type in test_types] return jsonify(result='Success', test_types=test_types, count=len(test_types))