Пример #1
0
 def test_post_purge(self):
     from core.Status import Status
     from core.TestType import TestType
     from core.Base import Base
     test_type = str(uuid.uuid4())
     tt = TestType(test_type)
     tt.save()
     my_run = str(uuid.uuid4())
     data = {'action': 'REMOVE', 'condition': {'operator': 'EQUAL', 'field': str(uuid.uuid4()), 'value': str(uuid.uuid4())}}
     json_query = prepare_json_query(data)
     rv = self.app_test_type.post('/test/test_types/{0}/purge'.format(str(uuid.uuid4())), headers=json_query['headers'], data=json_query['json'])
     assert rv.status_code == 404
     data = {'action': str(uuid.uuid4()), 'condition': {'operator': 'EQUAL', 'field': str(uuid.uuid4()), 'value': str(uuid.uuid4())}}
     json_query = prepare_json_query(data)
     rv = self.app_test_type.post('/test/test_types/{0}/purge'.format(test_type), headers=json_query['headers'], data=json_query['json'])
     assert rv.status_code == 400
     data = {'action': 'REMOVE', 'condition': {'operator': str(uuid.uuid4()), 'field': str(uuid.uuid4()), 'value': str(uuid.uuid4())}}
     json_query = prepare_json_query(data)
     rv = self.app_test_type.post('/test/test_types/{0}/purge'.format(test_type), headers=json_query['headers'], data=json_query['json'])
     assert rv.status_code == 400
     data = {'action': 'REMOVE', 'condition': {'operator': 'EQUAL', 'field': str(uuid.uuid4()), 'value': str(uuid.uuid4())}}
     json_query = prepare_json_query(data)
     rv = self.app_test_type.post('/test/test_types/{0}/purge'.format(test_type), headers=json_query['headers'], data=json_query['json'])
     assert rv.status_code == 200
     rv = self.app_test_type.get('/test/test_types/{0}/purge'.format(test_type))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['result'] == 'Success'
     assert res['purge']['action'] == data['action']
     assert res['purge']['condition'] == data['condition']
     rv = self.app_test_type.get('/test/test_types/{0}'.format(test_type))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['result'] == 'Success'
     assert res['test_type']['purge'] == '/test/test_types/{0}/purge'.format(test_type)
Пример #2
0
 def test_should_i_run_custom_all(self):
     from core.Status import Status
     from core.TestType import TestType
     test_type = str(uuid.uuid4())
     tt = TestType(test_type)
     tt.add_run_type('default', 'ALL', {'field': 'Status._status', 'operator': 'EQUAL', 'value': 'SUCCESS'})
     tt.save()
     test_id = str(uuid.uuid4())
     test_status1 = 'FAILURE'
     details = {'browser': random.choice(['Firefox', 'Chrome'])}
     status1 = Status(test_id, test_type, test_status1, details=details)
     status1.save_and_update()
     res = Status(test_id).should_i_run()
     assert res == False
     test_id2 = str(uuid.uuid4())
     test_status2 = 'SUCCESS'
     status2 = Status(test_id2, test_type, test_status2, details=details)
     status2.save_and_update()
     res = Status(test_id).should_i_run()
     assert res == False
     test_status3 = 'SUCCESS'
     status3 = Status(test_id, test_type, test_status3, details=details)
     status3.save_and_update()
     res = Status(test_id).should_i_run()
     assert res == False
     res = Status(test_id2).should_i_run()
     assert res == True
     status2 = Status(test_id2, test_type, test_status2, details=details)
     status2.save_and_update()
     res = Status(test_id2).should_i_run()
     assert res == True
Пример #3
0
 def test_repr_getter_setter(self):
     from core.TestType import TestType
     my_type = str(uuid.uuid4())
     doc = [str(uuid.uuid4()), str(uuid.uuid4()), str(uuid.uuid4())]
     doc_fields_to_index = [doc[0]]
     test_type = TestType(my_type, doc, doc_fields_to_index)
     assert '{0}'.format(test_type) == '<TestType {0} ({1})>'.format(my_type, doc)
     assert test_type.to_dict() == {'type': my_type, 'doc_fields': doc, 'doc_fields_to_index': [doc[0]]}
     test_type2 = TestType.from_dict(test_type.to_dict())
     assert test_type2.to_dict() == test_type.to_dict()
Пример #4
0
 def test_save(self):
     from core.TestType import TestType
     from core.Base import Base
     my_type = str(uuid.uuid4())
     doc = [str(uuid.uuid4()), str(uuid.uuid4()), str(uuid.uuid4())]
     test_type = TestType(my_type, doc)
     test_type.save()
     ast = Base().get_all(TestType.collection, {})
     assert ast.count() == 1
     assert ast[0]['type'] == my_type
     assert ast[0]['doc_fields'] == doc
Пример #5
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))
Пример #6
0
 def test_should_i_run_custom(self):
     from core.Status import Status
     from core.TestType import TestType
     test_type = str(uuid.uuid4())
     tt = TestType(test_type)
     tt.add_run_type('ALLOK', 'ALL', {'field': 'Status._status', 'operator': 'EQUAL', 'value': 'SUCCESS'})
     tt.save()
     test_id = str(uuid.uuid4())
     details = {'browser': 'Firefox'}
     test_type = str(uuid.uuid4())
     test_status1 = 'SUCCESS'
     status1 = Status(test_id, test_type, test_status1, details=details)
     status1.save_and_update()
     rv = self.app_test.get('/test/tests/{0}/run/ALLOK'.format(test_id))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['result'] == 'Success'
     assert res['run'] == True
     test_status2 = 'FAILURE'
     status2 = Status(test_id, test_type, test_status2, details=details)
     status2.save_and_update()
     rv = self.app_test.get('/test/tests/{0}/run/ALLOK'.format(test_id))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['result'] == 'Success'
     assert res['run'] == False
     rv = self.app_test.get('/test/tests/{0}/run'.format(test_id))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['result'] == 'Success'
     assert res['run'] == False
     test_status2 = 'SUCCESS'
     status2 = Status(test_id, test_type, test_status2, details=details)
     status2.save_and_update()
     rv = self.app_test.get('/test/tests/{0}/run/ALLOK'.format(test_id))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['result'] == 'Success'
     assert res['run'] == False
     rv = self.app_test.get('/test/tests/{0}/run'.format(test_id))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['result'] == 'Success'
     assert res['run'] == True
     rv = self.app_test.get('/test/tests/{0}/run/{1}'.format(test_id, str(uuid.uuid4())))
     assert rv.status_code == 404
Пример #7
0
def runlist_get(test_type):
    testType = TestTypeCore.get_one({TestTypeCore._test_type: test_type})
    if testType is None:
        abort(404)
    runs = [] if testType._run is None else [run for run in testType._run]
    runs.append('default')
    runs = {run: run_get(test_type, run) for run in runs}
    return runs
Пример #8
0
 def get(self, test_type, field):
     testType = TestTypeCore.get_one({TestTypeCore._test_type: test_type})
     if testType is None:
         abort(404)
     index = IndexCore(test_type=test_type, field=field).get()
     if index is None:
         abort(404)
     index = prep_index(index)
     return jsonify(result='Success', index=index)
Пример #9
0
def purge_get(test_type):
    testType = TestTypeCore.get_one({TestTypeCore._test_type: test_type})
    if testType is None:
        abort(404)
    purge = testType.purge()
    purge_dict = {'_links': {}}
    purge_dict['condition'] = purge['condition'].to_dict()
    purge_dict['action'] = purge['action']
    add_link_or_expand(purge_dict, 'self', 'purge', test_type=test_type)
    return purge_dict
Пример #10
0
 def test_get_run(self):
     from core.Status import Status
     from core.TestType import TestType
     from core.Base import Base
     test_id = str(uuid.uuid4())
     test_status = 'SUCCESS'
     test_type = str(uuid.uuid4())
     field1 = 'browser'
     field2 = 'environment'
     tt = TestType(test_type, doc_fields_to_index=[field1, field2])
     tt.add_run_type('new', 'ANY', {'operator': 'EQUAL', 'field': 1, 'value': 1})
     tt.save()
     details1 = {field1: 'Firefox', field2: 'master'}
     status1 = Status(test_id, test_type, test_status, details=details1)
     status1.save()
     rv = self.app_test_type.get('/test/test_types/{0}/runs/{1}'.format(str(uuid.uuid4()), 'default'))
     assert rv.status_code == 404
     rv = self.app_test_type.get('/test/test_types/{0}/runs/{1}'.format(test_type, str(uuid.uuid4())))
     assert rv.status_code == 404
     rv = self.app_test_type.get('/test/test_types/{0}/runs/{1}'.format(test_type, 'default'))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['result'] == 'Success'
     assert res['run']['modifier'] == TestType._default_run['modifier']
     assert res['run']['condition'] == TestType._default_run['condition'].to_dict()
     rv = self.app_test_type.get('/test/test_types/{0}/runs/{1}'.format(test_type, 'new'))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['result'] == 'Success'
     assert res['run']['modifier'] == 'ANY'
     assert res['run']['condition'] == {'operator': 'EQUAL', 'field': 1, 'value': 1}
     rv = self.app_test_type.get('/test/test_types/{0}/runs'.format(str(uuid.uuid4())))
     assert rv.status_code == 404
     rv = self.app_test_type.get('/test/test_types/{0}/runs'.format(test_type))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['result'] == 'Success'
     assert res['count'] == 2
     rv = self.app_test_type.get('/test/test_types/{0}'.format(test_type))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['result'] == 'Success'
     assert 'run' not in res['test_type']
Пример #11
0
def run_get(test_type, run_type):
    testType = TestTypeCore.get_one({TestTypeCore._test_type: test_type})
    if testType is None:
        abort(404)
    run = testType.run(run_type)
    if run is None:
        abort(404)
    run_dict = {'_links': {}}
    run_dict['condition'] = run['condition'].to_dict()
    run_dict['modifier'] = run['modifier']
    add_link_or_expand(run_dict, 'self', 'run', test_type=test_type, run_type=run_type)
    return run_dict
Пример #12
0
 def patch(self, test_type):
     testType = TestTypeCore.get_one({TestTypeCore._test_type: test_type})
     if testType is None:
         abort(404)
     parser = reqparse.RequestParser()
     parser.add_argument('doc_fields_to_index', type=str, help='list of the document fields to index', required=False, action='append')
     args = parser.parse_args()
     if args['doc_fields_to_index'] is not None:
         testType._doc_fields_to_index = args['doc_fields_to_index']
     testType.save()
     testType = prep_test_type(testType)
     return jsonify(result='Success', test_type=testType)
Пример #13
0
 def test_get_purge(self):
     from core.Status import Status
     from core.TestType import TestType
     from core.Base import Base
     test_id = str(uuid.uuid4())
     test_status = 'SUCCESS'
     test_type = str(uuid.uuid4())
     field1 = 'browser'
     field2 = 'environment'
     tt = TestType(test_type, doc_fields_to_index=[field1, field2])
     tt.save()
     details1 = {field1: 'Firefox', field2: 'master'}
     status1 = Status(test_id, test_type, test_status, details=details1)
     status1.save()
     rv = self.app_test_type.get('/test/test_types/{0}/purge'.format(str(uuid.uuid4())))
     assert rv.status_code == 404
     rv = self.app_test_type.get('/test/test_types/{0}/purge'.format(test_type))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['result'] == 'Success'
     assert res['purge']['action'] == TestType._default_purge['action']
     assert res['purge']['condition'] == TestType._default_purge['condition'].to_dict()
Пример #14
0
 def post(self, test_type):
     data = request.get_json()
     action = data['action']
     condition = data['condition']
     testType = TestTypeCore.get_one({TestTypeCore._test_type: test_type})
     if testType is None:
         abort(404)
     if action not in TestTypeCore.actions:
         abort(400)
     if not testType.set_purge(action, condition):
         abort(400)
     purge = purge_get(test_type)
     return jsonify(result='Success', purge=purge)
Пример #15
0
    def test_post_run(self):
        from core.Status import Status
        from core.TestType import TestType
        from core.Base import Base
        test_type = str(uuid.uuid4())
#        field1 = 'browser'
#        field2 = 'environment'
        tt = TestType(test_type)#, doc_fields_to_index=[field1, field2])
        tt.save()
        my_run = str(uuid.uuid4())
        data = {'run_type': my_run, 'modifier': 'ANY', 'condition': {'operator': 'EQUAL', 'field': str(uuid.uuid4()), 'value': str(uuid.uuid4())}}
        json_query = prepare_json_query(data)
        rv = self.app_test_type.post('/test/test_types/{0}/runs'.format(str(uuid.uuid4())), headers=json_query['headers'], data=json_query['json'])
        assert rv.status_code == 404
        data = {'run_type': my_run, 'modifier': str(uuid.uuid4()), 'condition': {'operator': 'EQUAL', 'field': str(uuid.uuid4()), 'value': str(uuid.uuid4())}}
        json_query = prepare_json_query(data)
        rv = self.app_test_type.post('/test/test_types/{0}/runs'.format(test_type), headers=json_query['headers'], data=json_query['json'])
        assert rv.status_code == 400
        data = {'run_type': my_run, 'modifier': 'ANY', 'condition': {'operator': str(uuid.uuid4()), 'field': str(uuid.uuid4()), 'value': str(uuid.uuid4())}}
        json_query = prepare_json_query(data)
        rv = self.app_test_type.post('/test/test_types/{0}/runs'.format(test_type), headers=json_query['headers'], data=json_query['json'])
        assert rv.status_code == 400
        data = {'run_type': my_run, 'modifier': 'ANY', 'condition': {'operator': 'OR', 'field': str(uuid.uuid4()), 'value': str(uuid.uuid4())}}
        json_query = prepare_json_query(data)
        rv = self.app_test_type.post('/test/test_types/{0}/runs'.format(test_type), headers=json_query['headers'], data=json_query['json'])
        assert rv.status_code == 400
        data = {'run_type': my_run, 'modifier': 'ANY', 'condition': {'operator': 'OR', 'part1': str(uuid.uuid4()), 'part2': {'operator': 'EQUAL', 'field': str(uuid.uuid4()), 'value': str(uuid.uuid4())}}}
        json_query = prepare_json_query(data)
        rv = self.app_test_type.post('/test/test_types/{0}/runs'.format(test_type), headers=json_query['headers'], data=json_query['json'])
        assert rv.status_code == 400
        data = {'run_type': my_run, 'modifier': 'ANY', 'condition': {'operator': 'OR', 'part1': {'operator': 'EQUAL', 'field': str(uuid.uuid4()), 'value': str(uuid.uuid4())}, 'part2': str(uuid.uuid4())}}
        json_query = prepare_json_query(data)
        rv = self.app_test_type.post('/test/test_types/{0}/runs'.format(test_type), headers=json_query['headers'], data=json_query['json'])
        assert rv.status_code == 400
        data = {'run_type': my_run, 'modifier': 'ALL', 'condition': {'operator': 'EQUAL', 'field': str(uuid.uuid4()), 'value': str(uuid.uuid4())}}
        json_query = prepare_json_query(data)
        rv = self.app_test_type.post('/test/test_types/{0}/runs'.format(test_type), headers=json_query['headers'], data=json_query['json'])
        assert rv.status_code == 200
Пример #16
0
 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
Пример #17
0
 def test_from_status(self):
     from core.TestType import TestType
     from core.Status import Status
     test_id = str(uuid.uuid4())
     test_status = random.choice(['SUCCESS', 'FAILURE'])
     test_type = str(uuid.uuid4())
     details = {'browser': random.choice(['Firefox', 'Chrome'])}
     status = Status(test_id, test_type, test_status, details=details)
     test_type_obj = TestType.from_status(status)
     assert test_type_obj._test_type == test_type
     assert test_type_obj._doc_fields == ['browser']
     assert test_type_obj._doc_fields_to_index == None
     assert test_type_obj._purge == None
     assert test_type_obj._run == None
Пример #18
0
 def post(self, test_type):
     data = request.get_json()
     run_type = data['run_type']
     modifier = data['modifier']
     condition = data['condition']
     testType = TestTypeCore.get_one({TestTypeCore._test_type: test_type})
     if testType is None:
         abort(404)
     if modifier not in TestTypeCore.modifiers:
         abort(400)
     if not testType.add_run_type(run_type, modifier, condition):
         abort(400)
     run = run_get(test_type, run_type)
     return jsonify(result='Success', run=run)
Пример #19
0
 def test_get_one(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()
     type2 = TestType.get_one({TestType._test_type: my_type2})
     assert type2._doc_fields == doc2
     assert type2._test_type == my_type2
     type1 = TestType.get_one({TestType._test_type: my_type1})
     assert type1._doc_fields == doc1
     assert type1._test_type == my_type1
Пример #20
0
 def test_get_collection(self):
     from core.TestType import TestType
     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()
     rv = self.app_test_type.get('/test/test_types')
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['count'] == 2
     assert [tt['type'] for tt in res['test_types']] == [my_type1, my_type2]
Пример #21
0
 def test_get(self):
     from core.TestType import TestType
     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()
     rv = self.app_test_type.get('/test/test_types/{0}'.format(my_type1))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['test_type']['type'] == my_type1
     rv = self.app_test_type.get('/test/test_types/{0}'.format(str(uuid.uuid4())))
     assert rv.status_code == 404
Пример #22
0
 def test_patch_testtype(self):
     from core.TestType import TestType
     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()
     my_id1 = str(uuid.uuid4())
     data1 = {'doc_fields_to_index': [str(uuid.uuid4()), str(uuid.uuid4())]}
     json_query = prepare_json_query(data1)
     rv = self.app_test_type.patch('/test/test_types/{0}'.format(my_type1), headers=json_query['headers'], data=json_query['json'])
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert res['test_type']['type'] == my_type1
     assert res['test_type']['doc_fields_to_index'] == data1['doc_fields_to_index']
     rv = self.app_test_type.patch('/test/test_types/{0}'.format(str(uuid.uuid4())), headers=json_query['headers'], data=json_query['json'])
     assert rv.status_code == 404
Пример #23
0
def testtype_get(test_type):
    testType = TestTypeCore.get_one({TestTypeCore._test_type: test_type})
    if testType is None:
        abort(404)
    testType = prep_test_type(testType)
    return testType
Пример #24
0
 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))
Пример #25
0
 def test_purge(self):
     from core.TestType import TestType
     from core.Base import Base
     from core.Filter import Filter
     my_type1 = str(uuid.uuid4())
     doc1 = [str(uuid.uuid4()), str(uuid.uuid4()), str(uuid.uuid4())]
     test_type = TestType(my_type1, doc1)
     assert test_type.purge() == test_type._default_purge
     assert test_type.set_purge('REMOVE', {'operator': str(uuid.uuid4()), 'field': 1, 'value': 1}) == False
     condition = {'operator': 'EQUAL', 'field': 1, 'value': 1}
     action = str(uuid.uuid4())
     res = test_type.set_purge(action, condition)
     assert res == False
     assert test_type.purge() == test_type._default_purge
     action = 'REMOVE'
     res = test_type.set_purge(action, condition)
     assert res
     assert test_type.to_dict()['purge']['action'] == action
     assert test_type.to_dict()['purge']['condition'] == condition
     test_type2 = TestType.from_dict(test_type.to_dict())
     assert test_type.purge()['action'] == 'REMOVE'
     assert test_type.purge()['condition'].to_dict() == condition
     assert test_type2.purge()['action'] == 'REMOVE'
     assert test_type2.purge()['condition'].to_dict() == condition
Пример #26
0
 def test_run(self):
     from core.TestType import TestType
     from core.Base import Base
     from core.Filter import Filter
     my_type1 = str(uuid.uuid4())
     doc1 = [str(uuid.uuid4()), str(uuid.uuid4()), str(uuid.uuid4())]
     test_type = TestType(my_type1, doc1)
     assert test_type.run() == test_type._default_run
     assert test_type.run('default') == test_type._default_run
     modifier = str(uuid.uuid4())
     res = test_type.add_run_type('new', modifier, {'operator': 'EQUAL', 'field': 1, 'value': 1})
     assert res == False
     assert test_type.run('new') == None
     modifier = 'ANY'
     res = test_type.add_run_type('new', modifier, {'operator': 'EQUAL', 'field': 1, 'value': 1})
     assert res
     assert test_type.run('new')['modifier'] == 'ANY'
     assert test_type.run('new')['condition'].to_dict() == {'operator': 'EQUAL', 'field': 1, 'value': 1}
     assert test_type.run('default') == test_type._default_run
     modifier = 'ALL'
     res = test_type.add_run_type('default', modifier, {'operator': 'EQUAL', 'field': 2, 'value': 3})
     assert res
     assert test_type.run('default')['modifier'] == 'ALL'
     assert test_type.run('default')['condition'].to_dict() == {'operator': 'EQUAL', 'field': 2, 'value': 3}
     assert test_type.run('not_existing') == None