Esempio n. 1
0
 def get(self, test_type):
     testType = TestTypeCore.get_one({TestTypeCore._test_type: test_type})
     if testType is None:
         abort(404)
     indexes = IndexCore.get_all({IndexCore._test_type: test_type})
     indexes = [prep_index(index) for index in indexes]
     return jsonify(result='Success', indexes=indexes, count=len(indexes))
Esempio n. 2
0
    def test_get_all(self):
        from core.Index import Index
        from core.Base import Base
        my_type1 = str(uuid.uuid4())
        my_type2 = str(uuid.uuid4())
        field1 = str(uuid.uuid4())
        field2 = str(uuid.uuid4())
        values1 = [str(uuid.uuid4()), str(uuid.uuid4()), str(uuid.uuid4())]
        index1 = Index(my_type1, field1, values1)
        index1.save()
#        values2 = [str(uuid.uuid4()), str(uuid.uuid4()), str(uuid.uuid4())]
        index2 = Index(my_type2, field2, values1)
        index2.save()
        indexes = Index.get_all()
        assert len(indexes) == 2
        indexes = Index.get_all({Index._test_type: my_type1})
        assert len(indexes) == 1
        indexes = Index.get_all({Index._values: values1})
        assert len(indexes) == 2
        indexes = Index().get_all({'type': my_type1})
        assert len(indexes) == 1