generated from CorrelAid/python-bare-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated line-length argument for isort, added tests for helloworld an…
…d profile, #48
- Loading branch information
1 parent
1f4af9e
commit e95835a
Showing
6 changed files
with
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from configparser import ConfigParser | ||
|
||
from mock import patch | ||
|
||
from pygenesis.helloworld import logincheck, whoami | ||
from tests.test_http_helper import _generic_request_status, mock_config_dict | ||
|
||
|
||
@patch("requests.get") | ||
@patch("pygenesis.helloworld.load_config") | ||
def test_whoami(mock_config, mock_requests): | ||
mock_config.return_value = mock_config_dict() | ||
mock_requests.return_value = _generic_request_status() | ||
|
||
whoami() | ||
|
||
|
||
@patch("requests.get") | ||
@patch("pygenesis.helloworld.load_config") | ||
def test_logincheck(mock_config, mock_requests): | ||
mock_config.return_value = mock_config_dict() | ||
mock_requests.return_value = _generic_request_status() | ||
|
||
logincheck() |
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 re | ||
from configparser import ConfigParser | ||
from pathlib import Path | ||
|
||
import pytest | ||
from mock import patch | ||
|
||
from pygenesis.profile import password, remove_result | ||
from tests.test_http_helper import _generic_request_status, mock_config_dict | ||
|
||
|
||
@pytest.fixture() | ||
def cache_dir(tmp_path_factory): | ||
# remove white-space and non-latin characters (issue fo some user names) | ||
temp_dir = str(tmp_path_factory.mktemp(".pygenesis")) | ||
temp_dir = re.sub(r"[^\x00-\x7f]", r"", temp_dir.replace(" ", "")) | ||
|
||
return Path(temp_dir) | ||
|
||
|
||
@patch("pygenesis.profile.get_config_path_from_settings") | ||
@patch("pygenesis.profile.get_data_from_endpoint") | ||
@patch("pygenesis.profile.load_config") | ||
def test_password(mock_config, mock_requests, mock_config_dir, cache_dir): | ||
mock_config.return_value = mock_config_dict() | ||
mock_requests.return_value = _generic_request_status() | ||
mock_config_dir.return_value = cache_dir | ||
|
||
password("new_password") | ||
|
||
|
||
def test_remove_results(): | ||
pass |