Split Last.fm/Libre.fm tests

This commit is contained in:
hugovk 2017-10-17 21:57:17 +03:00
parent 31aeb6e69a
commit 2aa4dbdf88
2 changed files with 37 additions and 22 deletions

View file

@ -2,12 +2,13 @@
"""
Integration (not unit) tests for pylast.py
"""
from flaky import flaky
import os
import pytest
import time
import unittest
import pytest
from flaky import flaky
import pylast
@ -1395,25 +1396,5 @@ class TestPyLastUser(PyLastTestCase):
self.assertEqual(mbid, None)
@flaky(max_runs=5, min_passes=1)
class TestPyLastWithLibreFm(unittest.TestCase):
"""Own class for Libre.fm because we don't need the Last.fm setUp"""
def test_libre_fm(self):
# Arrange
secrets = load_secrets()
username = secrets["username"]
password_hash = secrets["password_hash"]
# Act
network = pylast.LibreFMNetwork(
password_hash=password_hash, username=username)
artist = network.get_artist("Radiohead")
name = artist.get_name()
# Assert
self.assertEqual(name, "Radiohead")
if __name__ == '__main__':
unittest.main(failfast=True)

34
tests/test_pylast_librefm.py Executable file
View file

@ -0,0 +1,34 @@
#!/usr/bin/env python
"""
Integration (not unit) tests for pylast.py
"""
import unittest
from flaky import flaky
import pylast
from test_pylast import load_secrets
@flaky(max_runs=5, min_passes=1)
class TestPyLastWithLibreFm(unittest.TestCase):
"""Own class for Libre.fm because we don't need the Last.fm setUp"""
def test_libre_fm(self):
# Arrange
secrets = load_secrets()
username = secrets["username"]
password_hash = secrets["password_hash"]
# Act
network = pylast.LibreFMNetwork(
password_hash=password_hash, username=username)
artist = network.get_artist("Radiohead")
name = artist.get_name()
# Assert
self.assertEqual(name, "Radiohead")
if __name__ == '__main__':
unittest.main(failfast=True)