这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions server/tests-py/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ def test_create_user_fail(self, hge_ctx):
assert status == 200, resp
assert 'data' in resp
action_id = resp['data']['create_user']
time.sleep(3)

query_async = '''
query ($action_id: uuid!){
Expand Down Expand Up @@ -206,7 +205,7 @@ def test_create_user_fail(self, hge_ctx):
'status': 200,
'response': response
}
check_query(hge_ctx, conf)
check_query_timeout(hge_ctx, conf, True, 10)

def test_create_user_success(self, hge_ctx):
graphql_mutation = '''
Expand All @@ -222,7 +221,6 @@ def test_create_user_success(self, hge_ctx):
assert status == 200, resp
assert 'data' in resp
action_id = resp['data']['create_user']
time.sleep(3)

query_async = '''
query ($action_id: uuid!){
Expand Down Expand Up @@ -273,7 +271,7 @@ def test_create_user_success(self, hge_ctx):
'status': 200,
'response': response
}
check_query(hge_ctx, conf)
check_query_timeout(hge_ctx, conf, True, 10)

def test_create_user_roles(self, hge_ctx):
graphql_mutation = '''
Expand All @@ -294,7 +292,6 @@ def test_create_user_roles(self, hge_ctx):
assert status == 200, resp
assert 'data' in resp
action_id = resp['data']['create_user']
time.sleep(3)

query_async = '''
query ($action_id: uuid!){
Expand Down Expand Up @@ -330,7 +327,7 @@ def test_create_user_roles(self, hge_ctx):
}
# Query the action as user-id 2
# Make request without auth using admin_secret
check_query(hge_ctx, conf_user_2, add_auth = False)
check_query_timeout(hge_ctx, conf_user_2, add_auth = False, timeout = 10)

conf_user_1 = {
'url': '/v1/graphql',
Expand All @@ -350,7 +347,20 @@ def test_create_user_roles(self, hge_ctx):
}
# Query the action as user-id 1
# Make request without auth using admin_secret
check_query(hge_ctx, conf_user_1, add_auth = False)
check_query_timeout(hge_ctx, conf_user_1, add_auth = False, timeout = 10)

def check_query_timeout(hge_ctx, conf, add_auth, timeout):
wait_until = time.time() + timeout
while True:
time.sleep(2)
try:
check_query(hge_ctx, conf, add_auth = add_auth)
except AssertionError:
if time.time() > wait_until:
raise
else:
continue
break

@pytest.mark.usefixtures('per_class_tests_db_state')
class TestSetCustomTypes:
Expand Down