Exemplo n.º 1
0
 def test_show_up_lyric_by_artist(self):
     a1 = Artist('ARTIST 1', self.user.get_id())
     db.session.add(a1)
     db.session.commit()
     al1 = Album('album 1', datetime.now(), self.user.get_id(), a1.get_id())
     db.session.add(al1)
     db.session.commit()
     l1 = Lyric('song 1', 'test 1', self.user.get_id(), al1.get_id())
     db.session.add(l1)
     db.session.commit()
     response = self.client.get('/lyrics/artist1/1')
     self.assertIn(b'Flask Lyric - song 1', response.data)
     self.assertIn(b'ARTIST 1 LYRICS', response.data)
     self.assertIn(b'test 1', response.data)
Exemplo n.º 2
0
 def test_show_up_artists_list_lyrics(self):
     a1 = Artist('ARTIST 1', self.user.get_id())
     db.session.add(a1)
     db.session.commit()
     al1 = Album('album 1', datetime.now(), self.user.get_id(), a1.get_id())
     al2 = Album('album 2', datetime.now(), self.user.get_id(), a1.get_id())
     db.session.add_all([al1, al2])
     db.session.commit()
     l1 = Lyric('song to test 1', '', self.user.get_id(), al1.get_id())
     l2 = Lyric('song to test 2', '', self.user.get_id(), al2.get_id())
     db.session.add_all([l1, l2])
     db.session.commit()
     response = self.client.get('/artist/artist1')
     self.assertIn(b'Flask Lyrics - artist 1', response.data)
     self.assertIn(b'album 1', response.data)
     self.assertIn(b'album 2', response.data)
     self.assertIn(b'song to test 1', response.data)
     self.assertIn(b'song to test 2', response.data)
Exemplo n.º 3
0
def artists_by_letter(letter):
    if  len(letter) == 1 and letter.isalpha():
        artists = Artist.get_artists_by_letter(letter)
        left = []
        right = []
        for i, artist in enumerate(artists):
            if i % 2 == 0:
                left.append(artist)
            else:
                right.append(artist)
        return render_template('artists.html', title='Flask Lyrics - Artists',
                                left=left, right=right, letter=letter)
    return redirect(url_for('home.home_'))
Exemplo n.º 4
0
from app import app, login_manager