-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add internal client * get the correct client type; add a test * entry in changelog * fix the test * switch create_service_json_entry to static method * combine 2 clients * rewrite test * hashing it properly
- Loading branch information
1 parent
13f3fda
commit ebaa993
Showing
7 changed files
with
113 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright (c) 2019 University of Illinois and others. All rights reserved. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License v2.0 which accompanies this distribution, | ||
# and is available at https://www.mozilla.org/en-US/MPL/2.0/ | ||
import os.path | ||
|
||
|
||
from pyincore import IncoreClient | ||
|
||
# from pyincore import DataService | ||
|
||
user = { | ||
"service_url": "http://localhost:8080", | ||
"internal": True, | ||
"username": "incrtest", | ||
"usergroups": ["incore_ncsa"], | ||
} | ||
|
||
|
||
def test_client_success(): | ||
""" | ||
testing successful login | ||
""" | ||
client = IncoreClient(**user) | ||
assert "incrtest" in str(client.session.headers["x-auth-userinfo"]) | ||
assert "incore_ncsa" in str(client.session.headers["x-auth-usergroup"]) | ||
|
||
|
||
def test_delete_repo_cache(): | ||
client = IncoreClient(**user) | ||
hashed_repo_dir_path = client.hashed_svc_data_dir | ||
client.clear_cache() | ||
assert os.path.exists(hashed_repo_dir_path) is False | ||
|
||
|
||
# def test_get_dataset_metadata(): | ||
# client = IncoreClient(**user) | ||
# datasvc_internal = DataService(client) | ||
# dataset_id = "5a284f09c7d30d13bc0819a6" | ||
# metadata = datasvc_internal.get_dataset_metadata(dataset_id) | ||
# assert metadata["id"] == dataset_id |