generated from UMassCDS/PythonProjectTemplate
-
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.
Added change log details and DHIS2 info in settings config file (#3)
* Added change log details and DHIS2 info in settings config file * Mock calls to the DHIS2 server in unit tests
- Loading branch information
Showing
11 changed files
with
75 additions
and
254 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/gutenberg_counts.csv | ||
MSF_data |
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,4 @@ | ||
[DHIS2Server] | ||
username= | ||
password= | ||
server_url= |
Empty file.
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 |
---|---|---|
@@ -1,8 +1,31 @@ | ||
import pytest | ||
import configparser | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
from msfocr.data.data_upload_DHIS2 import configure_DHIS2_server | ||
|
||
@pytest.fixture | ||
def datadir(request): | ||
def datadir(): | ||
# Path to the directory containing test data | ||
test_data_dir = Path(__file__).parent / 'data' | ||
return test_data_dir | ||
|
||
|
||
@pytest.fixture | ||
def test_server_config(tmp_path): | ||
"""Configure a mock DHIS2 server to mimic requests. | ||
You will still need to use requests_mock to imitate responses from http://test.com. | ||
""" | ||
config = configparser.ConfigParser() | ||
config["DHIS2Server"] = {"username": "tester", | ||
"password": "testing_password", | ||
"server_url": "http://test.com" | ||
} | ||
configpath = tmp_path / "test_settings.ini" | ||
with configpath.open("w") as configfile: | ||
config.write(configfile) | ||
|
||
configure_DHIS2_server(configpath) | ||
|
||
|
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