From f039a1e354b54b975acf23e135cbc2d5bd436e8a Mon Sep 17 00:00:00 2001 From: Muhammad Risky Pahlevi Date: Fri, 23 Aug 2024 10:28:29 +0700 Subject: [PATCH 1/3] Affected Issue(s): Fixes when try to run within Windows OS environment Resolves https://github.com/sid-indonesia/it-team/issues/313 What this commit has achieved: 1. Renamed an entry in `.env` from `username` to `user_name` to accomodate usage within Windows OS (there is a default OS env var %username% within Windows OS) 2. Added `python-magic-bin` to the `requirements.txt`, to resolve issue of: ``` ImportError: failed to find libmagic. Check your installation ``` (Possibly only happens in Windows OS, not really sure) --- importer/README.md | 2 +- importer/importer/config/settings.py | 2 +- importer/requirements.txt | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/importer/README.md b/importer/README.md index bda42047..4f75cb78 100644 --- a/importer/README.md +++ b/importer/README.md @@ -36,7 +36,7 @@ product_access_token = 'example-product-access-token' # if using resource owner credentials (i.e importer handles getting authentication by itself) # This has greater precedence over the access and refresh tokens if supplied -username = 'example-username' +user_name = 'example-user_name' password = 'example-password' # if embedding importer into a service that already does the authentication diff --git a/importer/importer/config/settings.py b/importer/importer/config/settings.py index b7a18e3f..1fc43040 100644 --- a/importer/importer/config/settings.py +++ b/importer/importer/config/settings.py @@ -17,7 +17,7 @@ product_access_token = os.getenv("product_access_token") -username = os.getenv("username") +username = os.getenv("user_name") password = os.getenv("password") access_token = os.getenv("access_token") diff --git a/importer/requirements.txt b/importer/requirements.txt index 7e68346d..f19a7636 100644 --- a/importer/requirements.txt +++ b/importer/requirements.txt @@ -8,6 +8,7 @@ pytest>=7.4.2 jsonschema==4.21.1 mock==5.1.0 python-magic==0.4.27 +python-magic-bin==0.4.14 jwt python-dotenv==1.0.1 pytest-env==1.1.3 From 22c48d78ea513bda9e21f42ea176d4786746ca1e Mon Sep 17 00:00:00 2001 From: Muhammad Risky Pahlevi Date: Fri, 23 Aug 2024 17:24:31 +0700 Subject: [PATCH 2/3] Affected Issue(s): Small fix on `requirements.txt` Resolves https://github.com/sid-indonesia/it-team/issues/313 What this commit has achieved: 1. Only add `python-magic-bin` as one of the requirements if the `sys_platform` is Windows. --- importer/requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/importer/requirements.txt b/importer/requirements.txt index f19a7636..cfe85f12 100644 --- a/importer/requirements.txt +++ b/importer/requirements.txt @@ -8,7 +8,8 @@ pytest>=7.4.2 jsonschema==4.21.1 mock==5.1.0 python-magic==0.4.27 -python-magic-bin==0.4.14 jwt python-dotenv==1.0.1 pytest-env==1.1.3 +# Windows requirements +python-magic-bin==0.4.14; sys_platform == 'win32' From 17704b868492fdc8208fd193b8098c72477321bd Mon Sep 17 00:00:00 2001 From: Muhammad Risky Pahlevi Date: Fri, 23 Aug 2024 20:41:22 +0700 Subject: [PATCH 3/3] Affected Issue(s): Fixed tests env Resolves https://github.com/sid-indonesia/it-team/issues/313 What this commit has achieved: 1. Renamed env var `username` to `user_name` in `pytest.ini`. 2. Corrected the order of default values in the `README.md` of `importer`. --- importer/README.md | 2 +- importer/pytest.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/importer/README.md b/importer/README.md index 4f75cb78..e603aac0 100644 --- a/importer/README.md +++ b/importer/README.md @@ -107,7 +107,7 @@ The coverage report `coverage.html` will be at the working directory - Run `python3 main.py --csv_file csv/organizations/organizations_min.csv --resource_type organizations --log_level info` - See example csv [here](/importer/csv/organizations/organizations_min.csv) - The first column __name__ is the only one required -- If the csv file has only the required column, (e.g. [organizations_min.csv](/importer/csv/organizations/organizations_min.csv)) the __id__ , __active__, and __method__ are set to __generating a new unique_uuid__ and the default values __create__ and __true__ respectively +- If the csv file has only the required column, (e.g. [organizations_min.csv](/importer/csv/organizations/organizations_min.csv)) the __id__ , __active__, and __method__ are set to __generating a new unique_uuid__ and the default values __true__ and __create__ respectively - [organizations_full](/importer/csv/organizations/organizations_full.csv) shows more options available - The third column is the request method, can be either create or update. Default is set to create - The fourth column is the id, which is required when updating diff --git a/importer/pytest.ini b/importer/pytest.ini index 50e40451..63101588 100644 --- a/importer/pytest.ini +++ b/importer/pytest.ini @@ -5,5 +5,5 @@ env = fhir_base_url = 'https://example.smartregister.org/fhir' keycloak_url = 'https://keycloak.smartregister.org/auth' realm = 'realm' - username = 'example-username' + user_name = 'example-username' password = 'example-password'