Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_key_error_wrong_format(capsys):
submit_utils.FDN_Key([("key_name", "my_key")], "key_name")
out = capsys.readouterr()[0]
message = "The keyfile does not exist, check the --keyfile path or add 'keypairs.json' to your home folder"
assert out.strip() == message
def test_key():
key = submit_utils.FDN_Key(keypairs, "default")
assert(key)
assert isinstance(key.server, string_types)
assert isinstance(key.authpw, string_types)
assert isinstance(key.authid, string_types)
def test_key_file():
key = submit_utils.FDN_Key('./tests/data_files/keypairs.json', "default")
assert(key)
assert isinstance(key.server, string_types)
assert isinstance(key.authpw, string_types)
assert isinstance(key.authid, string_types)
def test_connection():
key = submit_utils.FDN_Key(keypairs, "default")
connection = submit_utils.FDN_Connection(key)
assert(connection)
assert(connection.auth)
assert(connection.server)
def test_FDN_url():
key = submit_utils.FDN_Key(keypairs, "default")
connection = submit_utils.FDN_Connection(key)
test_objid_frame = [["trial", None],
["trial?some", None],
["trial", "object"],
["trial?some", "object"]
]
expected_url = ["https://data.4dnucleome.org/trial?limit=all",
"https://data.4dnucleome.org/trial?some&limit=all",
"https://data.4dnucleome.org/trial?limit=all&frame=object",
"https://data.4dnucleome.org/trial?some&limit=all&frame=object"
]
for n, case in enumerate(test_objid_frame):
t_url = submit_utils.FDN_url(case[0], connection, case[1])
assert t_url == expected_url[n]
def mkey():
return submit_utils.FDN_Key(keypairs, "default")
def test_test_connection_fail():
key = submit_utils.FDN_Key(keypairs, "default")
connection = submit_utils.FDN_Connection(key)
assert connection.check is False