Skip to content

Commit

Permalink
Added test for getAllUIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
ginic committed Jul 9, 2024
1 parent a0c563f commit d11278e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/msfocr/data/data_upload_DHIS2.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ def getAllUIDs(item_type, search_items):
if len(items) > 0:
print(items[0])

id = [(item['displayName'], item['id']) for item in items]
uid = [(item['displayName'], item['id']) for item in items]

return id
return uid
9 changes: 9 additions & 0 deletions tests/test_data_upload_DHIS2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from msfocr.data.data_upload_DHIS2 import getAllUIDs

def test_getAllUIDs(test_server_config, requests_mock):
requests_mock.get("http://test.com/api/categoryOptions?filter=name:ilike:12-59m", json={'categoryOptions': [{'id': 'tWRttYIzvBn', 'displayName': '12-59m'}]})
expected_result = [('12-59m', 'tWRttYIzvBn')]
result = getAllUIDs("categoryOptions", ["12-59m"])

assert expected_result == result

0 comments on commit d11278e

Please sign in to comment.