Skip to content

Commit

Permalink
add unit tests for licenses views (packs and bookmarks)
Browse files Browse the repository at this point in the history
  • Loading branch information
quimmrc committed Dec 13, 2024
1 parent 31d2779 commit 08a9bcf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bookmarks/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_bookmarks(self):
self.assertEqual(1, len(response.context['page'].object_list)) # 1 bookmark uncategorized
self.assertEqual(1, len(response.context['bookmark_categories'])) # 1 bookmark cateogry

# Test bookmark cateogry page
# Test bookmark category page
response = self.client.get(reverse('bookmarks-category', kwargs={'category_id': category.id}))
self.assertEqual(200, response.status_code)
self.assertEqual(2, len(response.context['page'].object_list)) # 2 sounds in cateogry
Expand All @@ -78,3 +78,7 @@ def test_bookmarks(self):
# Test category does not exist
response = self.client.get(reverse('bookmarks-category', kwargs={'category_id': 1234}))
self.assertEqual(404, response.status_code)

# Test category licenses for downloading
response = self.client.get(reverse('category-licenses', kwargs={'category_id': category.id}))
self.assertEqual(200, response.status_code)
3 changes: 3 additions & 0 deletions utils/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def test_download_sounds(self):
ret = utils.downloads.download_sounds(licenses_url, licenses_content, sounds_list, pack.friendly_filename())
self.assertEqual(ret.status_code, 200)

ret = self.client.get(reverse('pack-licenses', args=["testuser", pack.id]))
self.assertEqual(ret.status_code, 200)

@override_uploads_path_with_temp_directory
def test_upload_sounds(self):
# create new sound files
Expand Down

0 comments on commit 08a9bcf

Please sign in to comment.