-
Notifications
You must be signed in to change notification settings - Fork 0
E2E BASE: Test for Results, Completeness Project and others #168
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
Conversation
d5ce802 to
67e2377
Compare
67e2377 to
be80c0c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #168 +/- ##
===========================================
+ Coverage 80.48% 81.24% +0.75%
===========================================
Files 196 196
Lines 10667 10747 +80
Branches 951 949 -2
===========================================
+ Hits 8585 8731 +146
+ Misses 1761 1683 -78
- Partials 321 333 +12 ☔ View full report in Codecov by Sentry. |
a634f80 to
6d8aaae
Compare
8c0ae79 to
3ae7541
Compare
| ) | ||
|
|
||
| # Test push tasks results to firebase | ||
| contributor_user_groups = ContributorUserGroupFactory.create_batch(2, **self.user_resource_kwargs) |
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.
Let's create this from the assets as we already have the mutation for the contributor_user_groups.
"create_contributor_user_group_data_list": [
{
"clientId": "01K49J0QPCZM2JCNC9AEE6HT8Y",,
"name": "User Group 01",
"description": "A user group for contributor user 01",
},
{
"clientId": "01K49J0QPCZM2JCNC9AEE6HT8R",,
"name": "User Group 01",
"description": "A user group for contributor user 01",
}
],
| # Replace userGroups | ||
| group_value[new_key]["userGroups"] = user_groups_input | ||
|
|
||
| ref_results = Config.FIREBASE_HELPER.ref(Config.FirebaseKeys.results_projects()) |
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.
| ref_results = Config.FIREBASE_HELPER.ref(Config.FirebaseKeys.results_projects()) | |
| ref_results = Config.FIREBASE_HELPER.ref(f"/v2/results/{project_id}/") |
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.
@susilnem Why?
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.
For e2e tests, you can directly specific the URLs
It helps to identify breaking changes.
| "app_version": mapping_session.app_version, | ||
| "start_time": mapping_session.start_time.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3] + "Z", | ||
| "end_time": mapping_session.end_time.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3] + "Z", | ||
| "results_count": MappingSessionResult.objects.count(), |
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.
Add other checks too!
| "results_count": MappingSessionResult.objects.count(), | |
| "mapping_session_count": MappingSession.objects.count(), | |
| "results_count": MappingSessionResult.objects.count(), | |
| "user_groups_count": MappingSessionUserGroup.objects.count(), | |
| MappingSessionResultTemp.objects.count(), | ||
| ] != [0, 0, 0, 0, 0] | ||
|
|
||
| mapping_session = MappingSession.objects.first() |
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.
Add a todo we need to find another way to check this!
|
|
||
| expected_pulled_results_data = test_data["expected_pulled_results_data"] | ||
| expected_pulled_results_data["project_firebase_id"] = next(iter(fb_results_data)) | ||
| assert pull_firebase_data == expected_pulled_results_data |
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.
| assert pull_firebase_data == expected_pulled_results_data | |
| assert pull_firebase_data == expected_pulled_results_data, "Difference found for pulled results data." | |
|
|
||
| user_groups_input = {str(ug.firebase_id): True for ug in contributor_user_groups} | ||
|
|
||
| for group_key, group_value in input_data[project_fb_id].items(): # noqa: B007 |
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.
| for group_key, group_value in input_data[project_fb_id].items(): # noqa: B007 | |
| for _, group_value in input_data[project_fb_id].items(): |
| assert mapping_session.end_time is not None | ||
|
|
||
| pull_firebase_data = { | ||
| "project_firebase_id": mapping_session.project_task_group.project.firebase_id, |
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.
| "project_firebase_id": mapping_session.project_task_group.project.firebase_id, |
| } | ||
|
|
||
| expected_pulled_results_data = test_data["expected_pulled_results_data"] | ||
| expected_pulled_results_data["project_firebase_id"] = next(iter(fb_results_data)) |
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.
| expected_pulled_results_data["project_firebase_id"] = next(iter(fb_results_data)) |
| MappingSessionUserGroup.objects.count(), | ||
| MappingSessionUserGroupTemp.objects.count(), | ||
| MappingSessionResultTemp.objects.count(), | ||
| ] == [0, 0, 0, 0, 0] |
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.
| ] == [0, 0, 0, 0, 0] | |
| ] == [0, 0, 0, 0, 0], "Mapping session data should be empty before pull from firebase" | |
| MappingSessionUserGroup.objects.count(), | ||
| MappingSessionUserGroupTemp.objects.count(), | ||
| MappingSessionResultTemp.objects.count(), | ||
| ] != [0, 0, 0, 0, 0] |
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.
| ] != [0, 0, 0, 0, 0] | |
| ] != [0, 0, 0, 0, 0], "Mapping session data should not be empty after pull from firebase" | |
cd05e8f to
36e4124
Compare
0196784 to
711d3d1
Compare
| ) | ||
|
|
||
| # Test push tasks results to firebase | ||
| # Creating ContributorUserGroup: Without authentication |
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.
Is this without authentication?
|
@Rup-Narayan-Rajbanshi Please add related PRs |
f0adf69 to
14c3727
Compare
- remove un-necessary publish tutorial step
14c3727 to
8ff0643
Compare
|
I have fixed the issues in this PR. |
Changes
Depends on
This PR doesn't introduce any:
printThis PR contains valid: