diff --git a/critiquebrainz/frontend/views/test/profile_apps.py b/critiquebrainz/frontend/views/test/profile_apps.py index baba95433..bac43e556 100644 --- a/critiquebrainz/frontend/views/test/profile_apps.py +++ b/critiquebrainz/frontend/views/test/profile_apps.py @@ -8,10 +8,10 @@ class ProfileApplicationsViewsTestCase(FrontendTestCase): def setUp(self): super(ProfileApplicationsViewsTestCase, self).setUp() - self.user = User(db_users.get_or_create(1, u"aef06569-098f-4218-a577-b413944d9493", new_user_data={ + self.user = User(db_users.get_or_create(1, "Tester", new_user_data={ "display_name": u"Tester", })) - self.hacker = User(db_users.get_or_create(2, u"9371e5c7-5995-4471-a5a9-33481f897f9c", new_user_data={ + self.hacker = User(db_users.get_or_create(2, "Hacker", new_user_data={ "display_name": u"Hacker!", })) self.application = dict( diff --git a/critiquebrainz/frontend/views/test/test_artist.py b/critiquebrainz/frontend/views/test/test_artist.py index 4d5c80d80..794192baf 100644 --- a/critiquebrainz/frontend/views/test/test_artist.py +++ b/critiquebrainz/frontend/views/test/test_artist.py @@ -32,7 +32,7 @@ class ArtistViewsTestCase(FrontendTestCase): def setUp(self): super(ArtistViewsTestCase, self).setUp() self.reviewer = User(db_users.get_or_create( - 1, "aef06569-098f-4218-a577-b413944d9493", new_user_data={"display_name": u"Reviewer"} + 1, "Reviewer", new_user_data={"display_name": u"Reviewer"} )) @mock.patch('critiquebrainz.frontend.external.musicbrainz_db.release_group.browse_release_groups') diff --git a/critiquebrainz/frontend/views/test/test_comment.py b/critiquebrainz/frontend/views/test/test_comment.py index e8155de1d..3f1ed92b9 100644 --- a/critiquebrainz/frontend/views/test/test_comment.py +++ b/critiquebrainz/frontend/views/test/test_comment.py @@ -30,10 +30,10 @@ class CommentViewsTestCase(FrontendTestCase): def setUp(self): super(CommentViewsTestCase, self).setUp() - self.reviewer = User(db_users.get_or_create(1, "aef06569-098f-4218-a577-b413944d9493", new_user_data={ + self.reviewer = User(db_users.get_or_create(1, "reviewer", new_user_data={ "display_name": u"Reviewer", })) - self.commenter = User(db_users.get_or_create(2, "9371e5c7-5995-4471-a5a9-33481f897f9c", new_user_data={ + self.commenter = User(db_users.get_or_create(2, "commenter", new_user_data={ "display_name": u"Commenter", })) self.license = db_license.create( diff --git a/critiquebrainz/frontend/views/test/test_profile.py b/critiquebrainz/frontend/views/test/test_profile.py index dddd30477..263902cbf 100644 --- a/critiquebrainz/frontend/views/test/test_profile.py +++ b/critiquebrainz/frontend/views/test/test_profile.py @@ -12,7 +12,7 @@ def setUp(self): id="CC BY-SA 3.0", full_name="Created so we can fill the form correctly.", ) - self.user = User(db_users.get_or_create(1, "aef06569-098f-4218-a577-b413944d9493", new_user_data={ + self.user = User(db_users.get_or_create(1, "Tester", new_user_data={ "display_name": "Tester", })) diff --git a/critiquebrainz/frontend/views/test/test_review.py b/critiquebrainz/frontend/views/test/test_review.py index 1c1e00369..ae1e479fe 100644 --- a/critiquebrainz/frontend/views/test/test_review.py +++ b/critiquebrainz/frontend/views/test/test_review.py @@ -15,10 +15,10 @@ class ReviewViewsTestCase(FrontendTestCase): def setUp(self): super(ReviewViewsTestCase, self).setUp() - self.user = User(db_users.get_or_create(1, "aef06569-098f-4218-a577-b413944d9493", new_user_data={ + self.user = User(db_users.get_or_create(1, "Tester", new_user_data={ "display_name": u"Tester", })) - self.hacker = User(db_users.get_or_create(2, "9371e5c7-5995-4471-a5a9-33481f897f9c", new_user_data={ + self.hacker = User(db_users.get_or_create(2, "Hacker", new_user_data={ "display_name": u"Hacker!", })) self.license = db_license.create( diff --git a/critiquebrainz/frontend/views/test/test_statistics.py b/critiquebrainz/frontend/views/test/test_statistics.py index 685444c0a..1761e0634 100644 --- a/critiquebrainz/frontend/views/test/test_statistics.py +++ b/critiquebrainz/frontend/views/test/test_statistics.py @@ -29,7 +29,7 @@ class StatisticsViewsTestCase(FrontendTestCase): def setUp(self): super(StatisticsViewsTestCase, self).setUp() - self.user = User(db_users.get_or_create(1, "aef06569-098f-4218-a577-b413944d9493", new_user_data={ + self.user = User(db_users.get_or_create(1, "Tester", new_user_data={ "display_name": u"Tester", })) self.license = db_license.create( diff --git a/critiquebrainz/frontend/views/test/test_user.py b/critiquebrainz/frontend/views/test/test_user.py index 17a9a35b7..b3f0bff49 100644 --- a/critiquebrainz/frontend/views/test/test_user.py +++ b/critiquebrainz/frontend/views/test/test_user.py @@ -9,10 +9,11 @@ class UserViewsTestCase(FrontendTestCase): def setUp(self): super(UserViewsTestCase, self).setUp() - self.user = User(db_users.get_or_create(1, "aef06569-098f-4218-a577-b413944d9493", new_user_data={ + self.user = User(db_users.get_or_create(1, "Tester", new_user_data={ "display_name": u"Tester", })) - self.admin = User(db_users.get_or_create(2, "9371e5c7-5995-4471-a5a9-33481f897f9c", new_user_data={ + self.hacker = User(db_users.create(musicbrainz_row_id = 2, display_name = u"Hacker")) + self.admin = User(db_users.get_or_create(3, "Admin", new_user_data={ "display_name": u"Admin", })) @@ -26,6 +27,17 @@ def test_reviews(self): self.assert200(response) self.assertIn("Tester", str(response.data)) + # test reviews for user present in db, and logged in + self.temporary_login(self.user) + response = self.client.get("/user/{user_id}".format(user_id=self.user.id)) + self.assert200(response) + self.assertIn("Tester", str(response.data)) + + # test reviews for user present in db, but without musicbrainz_id + response = self.client.get("/user/{user_id}".format(user_id=self.hacker.id)) + self.assert200(response) + self.assertIn("Hacker", str(response.data)) + def test_info(self): # test info for user not in db response = self.client.get("/user/{user_id}/info".format(user_id="random-user-id"))