Skip to content
Snippets Groups Projects
Commit 40a737d0 authored by Chandrasekhar Ramakrishnan's avatar Chandrasekhar Ramakrishnan
Browse files

SSDM-3554: Implemented storage and reading of credentials from file.

parent b8f086cc
No related branches found
No related tags found
No related merge requests found
......@@ -59,7 +59,9 @@ class OpenbisCredentialStore:
"""
if not os.path.exists(self.store_path):
return OpenbisCredentials()
# TODO Implement reading a credentials file
with open(self.store_path, "r") as f:
token = f.read()
return OpenbisCredentials(token)
def write(self, credentials):
"""Write a credentials object to the store, overwriting any previous information.
......
......@@ -18,4 +18,5 @@ def test_credentials_store(tmpdir):
store = OpenbisCredentialStore(str(tmpdir))
store.write(credentials)
disk_credentials = store.read()
assert credentials.token == disk_credentials.token
\ No newline at end of file
assert credentials.token == disk_credentials.token
assert not disk_credentials.has_username_and_password()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment