TestPyLastWithLastFm and TestPyLastWithLibreFm now inherit from PyLastTestCase
This commit is contained in:
parent
70aad87a1b
commit
f18fd3f758
|
@ -6,10 +6,10 @@ import unittest
|
||||||
|
|
||||||
import pylast
|
import pylast
|
||||||
|
|
||||||
from .test_pylast import PyLastTestCase
|
from .test_pylast import TestPyLastWithLastFm
|
||||||
|
|
||||||
|
|
||||||
class TestPyLastAlbum(PyLastTestCase):
|
class TestPyLastAlbum(TestPyLastWithLastFm):
|
||||||
|
|
||||||
def test_album_tags_are_topitems(self):
|
def test_album_tags_are_topitems(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
|
@ -6,10 +6,10 @@ import unittest
|
||||||
|
|
||||||
import pylast
|
import pylast
|
||||||
|
|
||||||
from .test_pylast import PyLastTestCase
|
from .test_pylast import TestPyLastWithLastFm
|
||||||
|
|
||||||
|
|
||||||
class TestPyLastArtist(PyLastTestCase):
|
class TestPyLastArtist(TestPyLastWithLastFm):
|
||||||
|
|
||||||
def test_repr(self):
|
def test_repr(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
|
@ -6,10 +6,10 @@ import unittest
|
||||||
|
|
||||||
import pylast
|
import pylast
|
||||||
|
|
||||||
from .test_pylast import PyLastTestCase
|
from .test_pylast import TestPyLastWithLastFm
|
||||||
|
|
||||||
|
|
||||||
class TestPyLastCountry(PyLastTestCase):
|
class TestPyLastCountry(TestPyLastWithLastFm):
|
||||||
|
|
||||||
def test_country_is_hashable(self):
|
def test_country_is_hashable(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
|
@ -6,10 +6,10 @@ import unittest
|
||||||
|
|
||||||
import pylast
|
import pylast
|
||||||
|
|
||||||
from .test_pylast import PyLastTestCase
|
from .test_pylast import TestPyLastWithLastFm
|
||||||
|
|
||||||
|
|
||||||
class TestPyLastLibrary(PyLastTestCase):
|
class TestPyLastLibrary(TestPyLastWithLastFm):
|
||||||
|
|
||||||
def test_repr(self):
|
def test_repr(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
|
@ -8,11 +8,11 @@ from flaky import flaky
|
||||||
|
|
||||||
import pylast
|
import pylast
|
||||||
|
|
||||||
from .test_pylast import load_secrets
|
from .test_pylast import PyLastTestCase, load_secrets
|
||||||
|
|
||||||
|
|
||||||
@flaky(max_runs=5, min_passes=1)
|
@flaky(max_runs=5, min_passes=1)
|
||||||
class TestPyLastWithLibreFm(unittest.TestCase):
|
class TestPyLastWithLibreFm(PyLastTestCase):
|
||||||
"""Own class for Libre.fm because we don't need the Last.fm setUp"""
|
"""Own class for Libre.fm because we don't need the Last.fm setUp"""
|
||||||
|
|
||||||
def test_libre_fm(self):
|
def test_libre_fm(self):
|
||||||
|
|
|
@ -7,10 +7,10 @@ import unittest
|
||||||
|
|
||||||
import pylast
|
import pylast
|
||||||
|
|
||||||
from .test_pylast import PyLastTestCase
|
from .test_pylast import TestPyLastWithLastFm
|
||||||
|
|
||||||
|
|
||||||
class TestPyLastNetwork(PyLastTestCase):
|
class TestPyLastNetwork(TestPyLastWithLastFm):
|
||||||
|
|
||||||
def test_scrobble(self):
|
def test_scrobble(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
|
@ -30,9 +30,18 @@ def load_secrets():
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
|
|
||||||
@flaky(max_runs=5, min_passes=1)
|
|
||||||
class PyLastTestCase(unittest.TestCase):
|
class PyLastTestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
def assert_startswith(self, str, prefix, start=None, end=None):
|
||||||
|
self.assertTrue(str.startswith(prefix, start, end))
|
||||||
|
|
||||||
|
def assert_endswith(self, str, suffix, start=None, end=None):
|
||||||
|
self.assertTrue(str.endswith(suffix, start, end))
|
||||||
|
|
||||||
|
|
||||||
|
@flaky(max_runs=5, min_passes=1)
|
||||||
|
class TestPyLastWithLastFm(PyLastTestCase):
|
||||||
|
|
||||||
secrets = None
|
secrets = None
|
||||||
|
|
||||||
def unix_timestamp(self):
|
def unix_timestamp(self):
|
||||||
|
@ -52,12 +61,6 @@ class PyLastTestCase(unittest.TestCase):
|
||||||
api_key=API_KEY, api_secret=API_SECRET,
|
api_key=API_KEY, api_secret=API_SECRET,
|
||||||
username=self.username, password_hash=password_hash)
|
username=self.username, password_hash=password_hash)
|
||||||
|
|
||||||
def assert_startswith(self, str, prefix, start=None, end=None):
|
|
||||||
self.assertTrue(str.startswith(prefix, start, end))
|
|
||||||
|
|
||||||
def assert_endswith(self, str, suffix, start=None, end=None):
|
|
||||||
self.assertTrue(str.endswith(suffix, start, end))
|
|
||||||
|
|
||||||
def helper_is_thing_hashable(self, thing):
|
def helper_is_thing_hashable(self, thing):
|
||||||
# Arrange
|
# Arrange
|
||||||
things = set()
|
things = set()
|
||||||
|
|
|
@ -6,10 +6,10 @@ import unittest
|
||||||
|
|
||||||
import pylast
|
import pylast
|
||||||
|
|
||||||
from .test_pylast import PyLastTestCase
|
from .test_pylast import TestPyLastWithLastFm
|
||||||
|
|
||||||
|
|
||||||
class TestPyLastTag(PyLastTestCase):
|
class TestPyLastTag(TestPyLastWithLastFm):
|
||||||
|
|
||||||
def test_tag_is_hashable(self):
|
def test_tag_is_hashable(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
|
@ -6,10 +6,10 @@ import unittest
|
||||||
|
|
||||||
import pylast
|
import pylast
|
||||||
|
|
||||||
from .test_pylast import PyLastTestCase
|
from .test_pylast import TestPyLastWithLastFm
|
||||||
|
|
||||||
|
|
||||||
class TestPyLastTrack(PyLastTestCase):
|
class TestPyLastTrack(TestPyLastWithLastFm):
|
||||||
|
|
||||||
def test_love(self):
|
def test_love(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
|
@ -7,10 +7,10 @@ import unittest
|
||||||
|
|
||||||
import pylast
|
import pylast
|
||||||
|
|
||||||
from .test_pylast import PyLastTestCase
|
from .test_pylast import TestPyLastWithLastFm
|
||||||
|
|
||||||
|
|
||||||
class TestPyLastUser(PyLastTestCase):
|
class TestPyLastUser(TestPyLastWithLastFm):
|
||||||
|
|
||||||
def test_repr(self):
|
def test_repr(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
Loading…
Reference in a new issue