From b6ed13a8c610dff5e697b3f816d332228af7b456 Mon Sep 17 00:00:00 2001 From: Chen2x Date: Wed, 24 May 2017 16:46:30 -0400 Subject: [PATCH] covered register_obj --- tests/conftest.py | 5 ++++- tests/services/test_submit_functions.py | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0760c3b..029e801 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -133,4 +133,7 @@ def mock_server(ctx): body='{"header" : {"code" : "200"}, "response" : {"result" : [{ "id":"12345", "alias": "fgfg", "status": "VALIDATED"}]}}', content_type="application/json", X_Token= "sdfsd") - #httpretty.register_uri(httpretty.GET, 'ftp.ega.ebi.ac.uk') \ No newline at end of file + + httpretty.register_uri(httpretty.POST, "%ssubmissions/12345/samples" % (ctx.obj['SETTINGS']['apiUrl']), + body='{"header" : {"code" : "200"}, "response" : {"result" : [{ "id":"12345", "alias": "fgfg", "status": "VALIDATED"}]}}', + content_type="application/json") diff --git a/tests/services/test_submit_functions.py b/tests/services/test_submit_functions.py index 4208887..f5e6b10 100644 --- a/tests/services/test_submit_functions.py +++ b/tests/services/test_submit_functions.py @@ -80,8 +80,13 @@ def test_logout_function(ctx): assert not 'sessionToken' in ctx.obj['SUBMISSION'] -def test_register_obj(): - pass +def test_register_obj(ctx): + current = os.getcwd() + os.chdir(os.path.join(current, 'tests/data/workspace/submittable')) + ctx.obj['SUBMISSION']['id'] = "12345" + ctx.obj['SUBMISSION']['sessionToken'] = "sdfsd" + register_obj(ctx, Unaligned('test_u').sample, 'sample') + os.chdir(current) def test_submit_submission(ctx): current = os.getcwd()