TestPyLastWithLastFm and TestPyLastWithLibreFm now inherit from PyLastTestCase

This commit is contained in:
Hugo 2018-04-16 21:09:52 +03:00
parent 70aad87a1b
commit f18fd3f758
10 changed files with 28 additions and 25 deletions

View file

@ -6,10 +6,10 @@ import unittest
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):
# Arrange

View file

@ -6,10 +6,10 @@ import unittest
import pylast
from .test_pylast import PyLastTestCase
from .test_pylast import TestPyLastWithLastFm
class TestPyLastArtist(PyLastTestCase):
class TestPyLastArtist(TestPyLastWithLastFm):
def test_repr(self):
# Arrange

View file

@ -6,10 +6,10 @@ import unittest
import pylast
from .test_pylast import PyLastTestCase
from .test_pylast import TestPyLastWithLastFm
class TestPyLastCountry(PyLastTestCase):
class TestPyLastCountry(TestPyLastWithLastFm):
def test_country_is_hashable(self):
# Arrange

View file

@ -6,10 +6,10 @@ import unittest
import pylast
from .test_pylast import PyLastTestCase
from .test_pylast import TestPyLastWithLastFm
class TestPyLastLibrary(PyLastTestCase):
class TestPyLastLibrary(TestPyLastWithLastFm):
def test_repr(self):
# Arrange

View file

@ -8,11 +8,11 @@ from flaky import flaky
import pylast
from .test_pylast import load_secrets
from .test_pylast import PyLastTestCase, load_secrets
@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"""
def test_libre_fm(self):

View file

@ -7,10 +7,10 @@ import unittest
import pylast
from .test_pylast import PyLastTestCase
from .test_pylast import TestPyLastWithLastFm
class TestPyLastNetwork(PyLastTestCase):
class TestPyLastNetwork(TestPyLastWithLastFm):
def test_scrobble(self):
# Arrange

View file

@ -30,9 +30,18 @@ def load_secrets():
return doc
@flaky(max_runs=5, min_passes=1)
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
def unix_timestamp(self):
@ -52,12 +61,6 @@ class PyLastTestCase(unittest.TestCase):
api_key=API_KEY, api_secret=API_SECRET,
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):
# Arrange
things = set()

View file

@ -6,10 +6,10 @@ import unittest
import pylast
from .test_pylast import PyLastTestCase
from .test_pylast import TestPyLastWithLastFm
class TestPyLastTag(PyLastTestCase):
class TestPyLastTag(TestPyLastWithLastFm):
def test_tag_is_hashable(self):
# Arrange

View file

@ -6,10 +6,10 @@ import unittest
import pylast
from .test_pylast import PyLastTestCase
from .test_pylast import TestPyLastWithLastFm
class TestPyLastTrack(PyLastTestCase):
class TestPyLastTrack(TestPyLastWithLastFm):
def test_love(self):
# Arrange

View file

@ -7,10 +7,10 @@ import unittest
import pylast
from .test_pylast import PyLastTestCase
from .test_pylast import TestPyLastWithLastFm
class TestPyLastUser(PyLastTestCase):
class TestPyLastUser(TestPyLastWithLastFm):
def test_repr(self):
# Arrange