Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(dhis2): add dhis2 tests #7

Merged
merged 6 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,27 @@ build-backend = "setuptools.build_meta"
name = "openhexa.toolbox"
version = "0.1.4"
description = "A set of tools to acquire & process data from various sources"
authors = [
{ name = "Bluesquare", email = "[email protected]"}
]
maintainers = [
{ name = "Bluesquare", email = "[email protected]" }
]
authors = [{ name = "Bluesquare", email = "[email protected]" }]
maintainers = [{ name = "Bluesquare", email = "[email protected]" }]
license = { file = "LICENSE" }
readme = "README.md"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent"
"Operating System :: OS Independent",
]
requires-python = ">=3.8"
dependencies = [
"requests",
"python-dateutil",
"pandas",
"polars",
"diskcache"
]
dependencies = ["requests", "python-dateutil", "pandas", "polars", "diskcache"]

[project.optional-dependencies]
dev = ["ruff~=0.0.278", "pytest~=7.3.0", "build~=0.10.0", "pytest-cov~=4.0.0" , "black~=23.7.0", "pre-commit"]
dev = [
"ruff~=0.0.278",
"pytest~=7.3.0",
"build~=0.10.0",
"pytest-cov~=4.0.0",
"black~=23.7.0",
"pre-commit",
]

[tool.setuptools.packages.find]
where = ["."]
Expand All @@ -47,3 +44,6 @@ line-length = 120

[tool.ruff.pycodestyle]
max-doc-length = 120

[tool.pytest.ini_options]
addopts = ["--import-mode=importlib"]
61 changes: 61 additions & 0 deletions tests/dhis2/responses/2.37/analytics/get_data_element_groups.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
responses:
- response:
auto_calculate_content_length: false
body: '{"headers":[{"name":"dx","column":"Data","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"co","column":"Category
option combo","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"ou","column":"Organisation
unit","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"pe","column":"Period","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"value","column":"Value","valueType":"NUMBER","type":"java.lang.Double","hidden":false,"meta":false}],"metaData":{"items":{"S34ULMcHMca":{"name":"0-11m"},"IUZ0GidX0jh":{"uid":"IUZ0GidX0jh","name":"Wounds/Trauma"},"KbO0JnhiMwl":{"name":"Dibia
MCHP"},"ou":{"name":"Organisation unit"},"f90eISKFm7P":{"name":"Doujou CHP"},"SdOUI2yT46H":{"name":"5-14y"},"wHBMVthqIX4":{"name":"12-59m"},"co":{"name":"Category
option combo"},"JQr6TJx5KE3":{"name":"Nyandehun CHP"},"HNv1aLPdMYb":{"name":"Kamalo
CHC"},"jOkIbJVhECg":{"name":"15y+"},"202201":{"name":"January 2022"},"yJwdE6XJbrF":{"name":"Wounds/Trauma
follow-up"},"dx":{"name":"Data"},"pe":{"name":"Period"},"JMKtVQ5HasH":{"name":"Wounds/Trauma
referrals"},"kpDoH80fwdX":{"name":"MCH Static"},"FJs8ZjlQE6f":{"name":"Wounds/Trauma
new"},"o2gxEt6Ek2C":{"name":"0-4y"},"hHKKi9WNoBG":{"name":"Kamiendor MCHP"},"ba1FkzknqS8":{"name":"5y+"}},"dimensions":{"dx":["JMKtVQ5HasH","FJs8ZjlQE6f","yJwdE6XJbrF"],"pe":["202201"],"ou":["JQr6TJx5KE3","KbO0JnhiMwl","f90eISKFm7P","HNv1aLPdMYb","hHKKi9WNoBG","kpDoH80fwdX"],"co":["S34ULMcHMca","SdOUI2yT46H","o2gxEt6Ek2C","wHBMVthqIX4","ba1FkzknqS8","jOkIbJVhECg"]}},"rows":[["FJs8ZjlQE6f","jOkIbJVhECg","JQr6TJx5KE3","202201","2"],["yJwdE6XJbrF","jOkIbJVhECg","f90eISKFm7P","202201","1"],["FJs8ZjlQE6f","jOkIbJVhECg","f90eISKFm7P","202201","1"],["FJs8ZjlQE6f","wHBMVthqIX4","JQr6TJx5KE3","202201","3"]],"width":5,"height":4,"headerWidth":5}'
content_type: text/plain
method: GET
status: 200
url: https://play.dhis2.org/2.37.9.1/api/analytics?dimension=dx%3ADE_GROUP-IUZ0GidX0jh&dimension=ou%3AJQr6TJx5KE3%3BKbO0JnhiMwl%3Bf90eISKFm7P%3BHNv1aLPdMYb%3BhHKKi9WNoBG%3BkpDoH80fwdX&dimension=pe%3A202201&dimension=co%3A&paging=True&ignoreLimit=True
- response:
auto_calculate_content_length: false
body: '{"headers":[{"name":"dx","column":"Data","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"co","column":"Category
option combo","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"ou","column":"Organisation
unit","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"pe","column":"Period","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"value","column":"Value","valueType":"NUMBER","type":"java.lang.Double","hidden":false,"meta":false}],"metaData":{"items":{"S34ULMcHMca":{"name":"0-11m"},"IUZ0GidX0jh":{"uid":"IUZ0GidX0jh","name":"Wounds/Trauma"},"KbO0JnhiMwl":{"name":"Dibia
MCHP"},"ou":{"name":"Organisation unit"},"f90eISKFm7P":{"name":"Doujou CHP"},"SdOUI2yT46H":{"name":"5-14y"},"wHBMVthqIX4":{"name":"12-59m"},"co":{"name":"Category
option combo"},"JQr6TJx5KE3":{"name":"Nyandehun CHP"},"HNv1aLPdMYb":{"name":"Kamalo
CHC"},"jOkIbJVhECg":{"name":"15y+"},"202202":{"name":"February 2022"},"yJwdE6XJbrF":{"name":"Wounds/Trauma
follow-up"},"dx":{"name":"Data"},"pe":{"name":"Period"},"JMKtVQ5HasH":{"name":"Wounds/Trauma
referrals"},"kpDoH80fwdX":{"name":"MCH Static"},"FJs8ZjlQE6f":{"name":"Wounds/Trauma
new"},"o2gxEt6Ek2C":{"name":"0-4y"},"hHKKi9WNoBG":{"name":"Kamiendor MCHP"},"ba1FkzknqS8":{"name":"5y+"}},"dimensions":{"dx":["JMKtVQ5HasH","FJs8ZjlQE6f","yJwdE6XJbrF"],"pe":["202202"],"ou":["JQr6TJx5KE3","KbO0JnhiMwl","f90eISKFm7P","HNv1aLPdMYb","hHKKi9WNoBG","kpDoH80fwdX"],"co":["S34ULMcHMca","SdOUI2yT46H","o2gxEt6Ek2C","wHBMVthqIX4","ba1FkzknqS8","jOkIbJVhECg"]}},"rows":[["FJs8ZjlQE6f","jOkIbJVhECg","JQr6TJx5KE3","202202","2"],["FJs8ZjlQE6f","S34ULMcHMca","hHKKi9WNoBG","202202","6"],["FJs8ZjlQE6f","wHBMVthqIX4","f90eISKFm7P","202202","2"],["FJs8ZjlQE6f","wHBMVthqIX4","hHKKi9WNoBG","202202","1"],["FJs8ZjlQE6f","jOkIbJVhECg","f90eISKFm7P","202202","1"]],"width":5,"height":5,"headerWidth":5}'
content_type: text/plain
method: GET
status: 200
url: https://play.dhis2.org/2.37.9.1/api/analytics?dimension=dx%3ADE_GROUP-IUZ0GidX0jh&dimension=ou%3AJQr6TJx5KE3%3BKbO0JnhiMwl%3Bf90eISKFm7P%3BHNv1aLPdMYb%3BhHKKi9WNoBG%3BkpDoH80fwdX&dimension=pe%3A202202&dimension=co%3A&paging=True&ignoreLimit=True
- response:
auto_calculate_content_length: false
body: '{"headers":[{"name":"dx","column":"Data","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"co","column":"Category
option combo","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"ou","column":"Organisation
unit","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"pe","column":"Period","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"value","column":"Value","valueType":"NUMBER","type":"java.lang.Double","hidden":false,"meta":false}],"metaData":{"items":{"S34ULMcHMca":{"name":"0-11m"},"IUZ0GidX0jh":{"uid":"IUZ0GidX0jh","name":"Wounds/Trauma"},"sFgNRYS5pBo":{"name":"Magbass
MCHP"},"ou":{"name":"Organisation unit"},"SdOUI2yT46H":{"name":"5-14y"},"wHBMVthqIX4":{"name":"12-59m"},"co":{"name":"Category
option combo"},"jOkIbJVhECg":{"name":"15y+"},"202201":{"name":"January 2022"},"yJwdE6XJbrF":{"name":"Wounds/Trauma
follow-up"},"dx":{"name":"Data"},"pe":{"name":"Period"},"vELbGdEphPd":{"name":"Jimmi
CHC"},"OTn9VMNEkdo":{"name":"Mathufulie MCHP"},"JMKtVQ5HasH":{"name":"Wounds/Trauma
referrals"},"FJs8ZjlQE6f":{"name":"Wounds/Trauma new"},"o2gxEt6Ek2C":{"name":"0-4y"},"ba1FkzknqS8":{"name":"5y+"},"jKZ0U8Og5aV":{"name":"Dodo
CHC"}},"dimensions":{"dx":["JMKtVQ5HasH","FJs8ZjlQE6f","yJwdE6XJbrF"],"pe":["202201"],"ou":["sFgNRYS5pBo","vELbGdEphPd","OTn9VMNEkdo","jKZ0U8Og5aV"],"co":["S34ULMcHMca","SdOUI2yT46H","o2gxEt6Ek2C","wHBMVthqIX4","ba1FkzknqS8","jOkIbJVhECg"]}},"rows":[["yJwdE6XJbrF","SdOUI2yT46H","jKZ0U8Og5aV","202201","1"],["FJs8ZjlQE6f","SdOUI2yT46H","jKZ0U8Og5aV","202201","2"]],"width":5,"height":2,"headerWidth":5}'
content_type: text/plain
method: GET
status: 200
url: https://play.dhis2.org/2.37.9.1/api/analytics?dimension=dx%3ADE_GROUP-IUZ0GidX0jh&dimension=ou%3AsFgNRYS5pBo%3BvELbGdEphPd%3BOTn9VMNEkdo%3BjKZ0U8Og5aV&dimension=pe%3A202201&dimension=co%3A&paging=True&ignoreLimit=True
- response:
auto_calculate_content_length: false
body: '{"headers":[{"name":"dx","column":"Data","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"co","column":"Category
option combo","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"ou","column":"Organisation
unit","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"pe","column":"Period","valueType":"TEXT","type":"java.lang.String","hidden":false,"meta":true},{"name":"value","column":"Value","valueType":"NUMBER","type":"java.lang.Double","hidden":false,"meta":false}],"metaData":{"items":{"S34ULMcHMca":{"name":"0-11m"},"IUZ0GidX0jh":{"uid":"IUZ0GidX0jh","name":"Wounds/Trauma"},"sFgNRYS5pBo":{"name":"Magbass
MCHP"},"ou":{"name":"Organisation unit"},"SdOUI2yT46H":{"name":"5-14y"},"wHBMVthqIX4":{"name":"12-59m"},"co":{"name":"Category
option combo"},"jOkIbJVhECg":{"name":"15y+"},"202202":{"name":"February 2022"},"yJwdE6XJbrF":{"name":"Wounds/Trauma
follow-up"},"dx":{"name":"Data"},"pe":{"name":"Period"},"vELbGdEphPd":{"name":"Jimmi
CHC"},"OTn9VMNEkdo":{"name":"Mathufulie MCHP"},"JMKtVQ5HasH":{"name":"Wounds/Trauma
referrals"},"FJs8ZjlQE6f":{"name":"Wounds/Trauma new"},"o2gxEt6Ek2C":{"name":"0-4y"},"ba1FkzknqS8":{"name":"5y+"},"jKZ0U8Og5aV":{"name":"Dodo
CHC"}},"dimensions":{"dx":["JMKtVQ5HasH","FJs8ZjlQE6f","yJwdE6XJbrF"],"pe":["202202"],"ou":["sFgNRYS5pBo","vELbGdEphPd","OTn9VMNEkdo","jKZ0U8Og5aV"],"co":["S34ULMcHMca","SdOUI2yT46H","o2gxEt6Ek2C","wHBMVthqIX4","ba1FkzknqS8","jOkIbJVhECg"]}},"rows":[["FJs8ZjlQE6f","jOkIbJVhECg","vELbGdEphPd","202202","25"],["FJs8ZjlQE6f","SdOUI2yT46H","vELbGdEphPd","202202","8"],["FJs8ZjlQE6f","jOkIbJVhECg","jKZ0U8Og5aV","202202","1"]],"width":5,"height":3,"headerWidth":5}'
content_type: text/plain
method: GET
status: 200
url: https://play.dhis2.org/2.37.9.1/api/analytics?dimension=dx%3ADE_GROUP-IUZ0GidX0jh&dimension=ou%3AsFgNRYS5pBo%3BvELbGdEphPd%3BOTn9VMNEkdo%3BjKZ0U8Og5aV&dimension=pe%3A202202&dimension=co%3A&paging=True&ignoreLimit=True
Loading
Loading