From 11b7fc3d0dfbe9fed7a7915913ffb76e39a66b6e Mon Sep 17 00:00:00 2001 From: Levi <78334846+muhammad-levi@users.noreply.github.com> Date: Fri, 23 Aug 2024 21:01:51 +0700 Subject: [PATCH] Affected Issue(s): Fixes when try to run within Windows OS environment (#268) * 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) * 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. * 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 | 4 ++-- importer/importer/config/settings.py | 2 +- importer/pytest.ini | 2 +- importer/requirements.txt | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/importer/README.md b/importer/README.md index bda42047..e603aac0 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 @@ -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/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/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' diff --git a/importer/requirements.txt b/importer/requirements.txt index 7e68346d..cfe85f12 100644 --- a/importer/requirements.txt +++ b/importer/requirements.txt @@ -11,3 +11,5 @@ python-magic==0.4.27 jwt python-dotenv==1.0.1 pytest-env==1.1.3 +# Windows requirements +python-magic-bin==0.4.14; sys_platform == 'win32'