@@ -57,6 +57,9 @@ def test_get_song_long_lyrics(self):
5757 self .assertEqual (len (response .data ["results" ]), 2 )
5858
5959 # check lyrics
60+ self .assertNotEqual (
61+ response .data ["results" ][1 ]["lyrics_preview" ]["text" ], self .song2 .lyrics
62+ )
6063 self .assertDictEqual (
6164 response .data ["results" ][1 ]["lyrics_preview" ],
6265 {
@@ -936,3 +939,34 @@ def test_put_song_embedded_work_subtitle(self):
936939 self .assertEqual (Work .objects .count (), 4 )
937940 workNew = Work .objects .get (title = "Work1" , subtitle = "" , work_type = self .wt1 )
938941 self .assertIsNotNone (workNew )
942+
943+
944+ class SongLyricsViewTestCase (LibraryAPITestCase ):
945+ def setUp (self ):
946+ # create a user without any rights
947+ self .user = self .create_user ("TestUser" )
948+
949+ # create test data
950+ self .create_test_data ()
951+
952+ # add lyrics to one song
953+ self .song2 .lyrics = """Mary had a little lamb
954+ Little lamb, little lamb
955+ Mary had a little lamb
956+ Its fleece was white as snow
957+ And everywhere that Mary went
958+ Mary went, Mary."""
959+ self .song2 .save ()
960+
961+ # Create urls to access these playlist entries
962+ self .url_song2 = reverse ("library-song-lyrics" , kwargs = {"pk" : self .song2 .id })
963+
964+ def test_get_lyrics (self ):
965+ """Get a song lyrics."""
966+ self .authenticate (self .user )
967+
968+ response = self .client .get (self .url_song2 )
969+
970+ self .assertEqual (response .status_code , status .HTTP_200_OK )
971+ self .assertEqual (response .data ["id" ], self .song2 .id )
972+ self .assertEqual (response .data ["lyrics" ], self .song2 .lyrics )
0 commit comments