-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from nens/added_tests
precommit
- Loading branch information
Showing
5 changed files
with
150 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
## 0.10 (unreleased) | ||
|
||
|
||
- Nothing changed yet. | ||
- Added gmw/gmn/upload/import | ||
|
||
|
||
## 0.9 (2024-04-23) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from datetime import date, datetime | ||
|
||
import pytest | ||
|
||
from api.tests import fixtures | ||
from gmn import serializers | ||
|
||
# this setup is chosen because ruff removes the fixture imports in other methods | ||
organisation = fixtures.organisation | ||
gmn = fixtures.gmn | ||
gmw = fixtures.gmw | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_gmn_serialization(gmn): | ||
serializer = serializers.GMNSerializer(instance=gmn) | ||
assert serializer.data["bro_id"] == gmn.bro_id | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_gmn_deserialization(gmn, organisation): | ||
input_data = { | ||
"data_owner": organisation.uuid, | ||
"bro_id": "GMN123456789", | ||
"delivery_accountable_party": "12345678", | ||
"quality_regime": "IMBRO", | ||
"name": "test", | ||
"delivery_context": "test", | ||
"monitoring_purpose": "test", | ||
"groundwater_aspect": "test", | ||
"start_date_monitoring": date(2000, 1, 1), | ||
"object_registration_time": datetime(2000, 1, 1), | ||
"registration_status": "test", | ||
"color": "#000fff", | ||
} | ||
serializer = serializers.GMNSerializer(data=input_data) | ||
assert serializer.is_valid(), serializer.errors |
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,14 @@ | ||
import pytest | ||
|
||
from api.tests import fixtures | ||
from gmw import serializers | ||
|
||
# this setup is chosen because ruff removes the fixture imports in other methods | ||
organisation = fixtures.organisation | ||
gmw = fixtures.gmw | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_gmw_serialization(gmw): | ||
serializer = serializers.GMWSerializer(instance=gmw) | ||
assert serializer.data["bro_id"] == gmw.bro_id |