Skip to content
Snippets Groups Projects
Commit f839495e authored by Mark Skipper's avatar Mark Skipper
Browse files

`add_term` in api views should return json of the serialized version of the...

`add_term` in api views should return json of the serialized version of the new item -- currently empty dict

https://trello.com/c/fWrvZDau/77-clear-out-technical-debt-from-working-on-taxonomies
parent 93ce5edc
No related branches found
No related tags found
1 merge request!10Data layer techdebt
......@@ -70,6 +70,15 @@ def test_item_can_haz_category(term, item):
# TODO test for terms with the same name in different taxonomies
@pytest.mark.django_db
def test_categorize_item_returns_the_categorized_item(term, item):
result = categorize_item(item, term).data
assert result['id'] == item['id']
terms = result['terms']
assert term in terms
@pytest.mark.django_db
def test_categorize_item_fails_gracefully_if_term_not_found(item):
response = categorize_item(
......
......@@ -50,8 +50,9 @@ class ItemViewSet(viewsets.ModelViewSet, BulkDestroyModelMixin):
return Response(data, status=status.HTTP_400_BAD_REQUEST)
item.apply_term(term)
data = {} # TODO should be the item containing the new term
return Response(data, status=status.HTTP_200_OK)
serializer = ItemSerializer(item)
return Response(serializer.data, status=status.HTTP_200_OK)
class TaxonomyViewSet(viewsets.ModelViewSet):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment