-
Notifications
You must be signed in to change notification settings - Fork 4
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 #86 from NERSC/85-client-silently-ignores-pem-file…
…-if-user-expansion-is-needed
- Loading branch information
Showing
8 changed files
with
1,044 additions
and
946 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,33 @@ | ||
import pytest | ||
|
||
from sfapi_client import Client | ||
from sfapi_client.exceptions import ClientKeyError | ||
|
||
|
||
@pytest.mark.public | ||
def test_wrong_key_data(fake_key_file, test_machine): | ||
with Client(key=fake_key_file) as client: | ||
with pytest.raises(Exception): | ||
# Raises OAuthError when trying to read incorrect PEM | ||
client.compute(test_machine) | ||
|
||
|
||
@pytest.mark.public | ||
def test_empty_key_file(empty_key_file): | ||
with pytest.raises(ClientKeyError): | ||
# Raise ClientKeyError for emtpy key file | ||
Client(key=empty_key_file) | ||
|
||
|
||
@pytest.mark.public | ||
def test_no_key_file_path(): | ||
with pytest.raises(ClientKeyError): | ||
# Raise error when there is no key present | ||
Client(key="~/name") | ||
|
||
|
||
@pytest.mark.public | ||
def test_no_key_file_name(): | ||
with pytest.raises(ClientKeyError): | ||
# Raise error when searching for keys | ||
Client(key="name") |