-
Notifications
You must be signed in to change notification settings - Fork 6
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
IA-2986: Have "sub org unit types to display" by default #1346
Merged
madewulf
merged 7 commits into
main
from
IA-2986-Have_sub-org-unit-types-to-display-by-default
Jun 13, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
913299b
Checking if there is at least a proposal review field before create a…
butofleury 0b7a0e6
setting up sub org unit type when importing data from gpkg file
butofleury 00b48e0
Adding test for importing org unit and setting up sub org unit type
butofleury 12d6992
Remove unused params for org unit seeding
butofleury 70f9548
Refactoring update sub type function
butofleury 828ab0b
Fix test for update org unit sub type
butofleury 71e05ad
Adding setuper folder in docker
butofleury File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from iaso.gpkg.import_gpkg import import_gpkg_file | ||
from iaso.models import Account, Project | ||
from iaso.test import APITestCase | ||
from setuper.pyramid import update_org_unit_sub_type | ||
|
||
|
||
class OrgUnitImportFromGPKG(APITestCase): | ||
@classmethod | ||
def setUpTestData(cls): | ||
cls.account = Account.objects.create(name="a") | ||
cls.user_test = cls.create_user_with_profile(username="test", account=cls.account) | ||
cls.project = Project.objects.create(name="Project 1", account=cls.account, app_id="test_app_id") | ||
|
||
def test_minimal_import_with_sub_org_unit_type(self): | ||
import_gpkg_file( | ||
"./iaso/tests/fixtures/gpkg/minimal.gpkg", | ||
project_id=self.project.id, | ||
source_name="test", | ||
version_number=1, | ||
validation_status="new", | ||
description="", | ||
) | ||
self.client.force_authenticate(self.user_test) | ||
response = self.client.get("/api/v2/orgunittypes/") | ||
self.assertJSONResponse(response, 200) | ||
response_data = response.json() | ||
|
||
updated_with_sub_types = update_org_unit_sub_type(self.client, self.project.id, response_data["orgUnitTypes"]) | ||
|
||
for org_unit_type_with in updated_with_sub_types: | ||
self.assertJSONResponse(org_unit_type_with, 200) | ||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know the expected new sub types here?
If so we should test that too in addition to testing the returned HTTP code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering for testing the expected new sub type, if from the line 27 we filter on the expected new sub types with ;
But, it looks a re-implement of the logic of update_org_unit_sub_type
Then, from line 29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I don't know if it's doable?
My point is that In general, we know what we are expecting from a test:
Here, the only thing that you are testing is that the API call returns 200, but we don't know if the data was modified in the expected way.
We can discuss this tomorrow, it may be easier to talk about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we really doing tests on the setuper? I'm thinking this might be overkill.