Skip to content

Commit

Permalink
Expose department code.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlvernay committed Jan 6, 2025
1 parent 47a88f6 commit d89fcfb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion territories/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Meta:
class DepartmentSerializer(BBoxMixin):
class Meta:
model = Department
fields = ("id", "name", "bbox")
fields = ("id", "name", "code", "bbox")


class AcademySerializer(BBoxMixin):
Expand Down
10 changes: 9 additions & 1 deletion tests/territories/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_get_territory_combined_list_filtered(self):
{
"id": mock.ANY,
"name": "Rhône",
"code": "69",
"bbox": {
"xmin": 5.0,
"ymin": 5.0,
Expand Down Expand Up @@ -92,7 +93,14 @@ def test_get_departments_list(self):

self.assertEqual(
response.json(),
[{"id": mock.ANY, "name": "Rhône", "bbox": {"xmin": 5.0, "ymin": 5.0, "xmax": 10.0, "ymax": 10.0}}],
[
{
"id": mock.ANY,
"name": "Rhône",
"code": "69",
"bbox": {"xmin": 5.0, "ymin": 5.0, "xmax": 10.0, "ymax": 10.0},
}
],
)

def test_get_cities_list(self):
Expand Down

0 comments on commit d89fcfb

Please sign in to comment.