-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from superconductive/graphql_auth
Update with Rob's changes. All tests pass.
- Loading branch information
Showing
4 changed files
with
240 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
pytest-cov==2.5.1 | ||
pytest==3.2.5 | ||
gql==0.1.0 | ||
requests==2.18.4 |
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 |
---|---|---|
@@ -1,3 +1 @@ | ||
pandas==0.22.0 | ||
pytest-cov==2.5.1 | ||
pytest==3.2.5 |
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 |
---|---|---|
|
@@ -17,7 +17,10 @@ | |
DQM_GRAPHQL_URL = os.getenv('DQM_GRAPHQL_URL', 'http://0.0.0.0:3010/graphql') | ||
|
||
|
||
pair = CooperPair(graphql_endpoint=DQM_GRAPHQL_URL) | ||
pair = CooperPair( | ||
graphql_endpoint=DQM_GRAPHQL_URL, | ||
email='[email protected]', | ||
password='foobar') | ||
|
||
SAMPLE_EXPECTATIONS_CONFIG = { | ||
'dataset_name': None, | ||
|
@@ -39,6 +42,40 @@ def test_init(): | |
assert pair.transport | ||
|
||
|
||
def test_init_client_without_credentials(): | ||
with pytest.warns(UserWarning): | ||
assert CooperPair(graphql_endpoint=DQM_GRAPHQL_URL) | ||
|
||
|
||
def test_login_success(): | ||
with pytest.warns(UserWarning): | ||
pair = CooperPair(graphql_endpoint=DQM_GRAPHQL_URL) | ||
assert pair.login( | ||
email='[email protected]', | ||
password='foobar') | ||
|
||
|
||
def test_login_failure(): | ||
with pytest.warns(UserWarning): | ||
pair = CooperPair(graphql_endpoint=DQM_GRAPHQL_URL) | ||
with pytest.warns(UserWarning): | ||
assert not pair.login( | ||
email='sdfjkhkdfsh', | ||
password='foobar') | ||
with pytest.warns(UserWarning): | ||
assert not pair.login( | ||
email='[email protected]') | ||
with pytest.warns(UserWarning): | ||
assert not pair.login( | ||
password='foobar') | ||
|
||
def test_unauthenticated_query(): | ||
with pytest.warns(UserWarning): | ||
pair = CooperPair(graphql_endpoint=DQM_GRAPHQL_URL) | ||
with pytest.warns(UserWarning): | ||
pair.add_evaluation(dataset_id=1, checkpoint_id=1, created_by_id=1) | ||
|
||
|
||
def test_bad_query(): | ||
with pytest.raises(AssertionError): | ||
pair.query('foobar') | ||
|