Skip to content

Commit

Permalink
Expose tags in API
Browse files Browse the repository at this point in the history
  • Loading branch information
symroe committed Dec 16, 2024
1 parent 8d480b4 commit b48e767
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ynr/apps/api/tests/test_api_next.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,23 @@ def test_sopn_on_ballot(self):
},
)

def test_tags_on_ballot(self):
self.edinburgh_east_post_ballot.tags = {
"NUTS1": {"key": "UKM", "value": "Scotland"}
}
self.edinburgh_east_post_ballot.save()

response = self.app.get(
"/api/next/ballots/{}/".format(
self.edinburgh_east_post_ballot.ballot_paper_id
)
)
result = response.json
self.assertEqual(
result["tags"],
{"NUTS1": {"key": "UKM", "value": "Scotland"}},
)

def test_no_results_on_ballot(self):
response = self.app.get(
"/api/next/ballots/{}/".format(
Expand Down
1 change: 1 addition & 0 deletions ynr/apps/elections/api/next/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class Meta:
"uncontested",
"results",
"voting_system",
"tags",
)

replaces = serializers.SlugRelatedField(
Expand Down

0 comments on commit b48e767

Please sign in to comment.