Skip to content

Commit

Permalink
Add user id to blog author
Browse files Browse the repository at this point in the history
  • Loading branch information
JElgar committed Sep 9, 2024
1 parent 3e8f934 commit ba4e9c9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion causes_service/blogs/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AuthorSerializer(serializers.ModelSerializer):

class Meta:
model = User
fields = ['name', 'description', 'picture']
fields = ['id', 'name', 'description', 'picture']

class BlogSerializer(serializers.ModelSerializer):
release_at_timestamp = serializers.IntegerField()
Expand Down
2 changes: 2 additions & 0 deletions causes_service/tests/integration/blogs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
def test_get_blog(client):
authors = [
UserFactory(
id = 10,
name="John Doe",
blog_profile_description="I am an avid blogger",
),
Expand All @@ -20,5 +21,6 @@ def test_get_blog(client):
assert response.status_code == 200
assert response.data['id'] == 1
assert len(response.data['authors']) == 2
assert response.data['authors'][0]['id'] == 10
assert response.data['authors'][0]['name'] == "John Doe"
assert response.data['authors'][0]['description'] == "I am an avid blogger"

0 comments on commit ba4e9c9

Please sign in to comment.