Skip to content

Commit

Permalink
test suite: fix bugs and typo, mark failures as expected (they are!)
Browse files Browse the repository at this point in the history
  • Loading branch information
Noiredd committed May 10, 2020
1 parent 485c762 commit a48a833
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions test/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class TestDatabaseUpdates(unittest.TestCase):
"""
@classmethod
def setUpClass(self):
self.api = FakeAPI('data')
self.api = FakeAPI('assets')
# Create the original database
self.orig_db = database.Database(
itemtype='Movie', api=self.api, callback=lambda x: x
Expand Down Expand Up @@ -285,50 +285,59 @@ def test_nonContinuousAddition(self):
scenario = UpdateScenario(removals=[0, 1, 2, 3, 6])
self.__test_body(scenario)

@unittest.expectedFailure
# The current algorithm is very naive and thus unable to do that.
def test_multipageAddition(self):
"""Add a few items non-continuously missing from multiple pages."""
scenario = UpdateScenario(removals=[0, 1, 2, 16, 30, 32])
self.__test_body(scenario)

# Removal tests
# Removal tests - are all expected to fail at this moment.

@unittest.expectedFailure
def test_singleRemoval(self):
"""Remove a single item from the first page."""
scenario = UpdateScenario(additions=[(0, 666)])
self.__test_body(scenario)

@unittest.expectedFailure
def test_simpleRemoval(self):
"""Remove a few items from the first page."""
scenario = UpdateScenario(additions=[(0, 666), (1, 4270)])
self.__test_body(scenario)

@unittest.expectedFailure
def test_randomRemoval(self):
"""Remove an item from somewhere on the first page."""
scenario = UpdateScenario(additions=[(4, 420)])
self.__test_body(scenario)

@unittest.expectedFailure
def test_nonContinuousRemoval(self):
"""Remove a few items non-continuously from the first page."""
scenario = UpdateScenario(
additions=[(0, 666), (1, 4270), (2, 2137), (5, 61504)]
)
self.__test_body(scenario)

@unittest.expectedFailure
def test_multipageRemoval(self):
"""Remove a few items non-continuously from multiple pages."""
scenario = UpdateScenario(
additions=[(3, 666), (4, 4270), (15, 2137), (35, 61504)]
)
self.__test_body(scenario)

# Other tests
# Other tests - for future features.

@unittest.expectedFailure
def test_complexAdditionRemoval(self):
"""Add and remove a few items at once, but only from the first page."""
scenario = UpdateScenario(
removals=[0, 1, 2, 9, 13],
additions=[(3, 1991), (4, 37132)]
)
self.__test_body(scenario)

@unittest.skip('Relevant feature not implemented yet.')
def test_difficultAdditionRemoval(self):
Expand All @@ -345,6 +354,7 @@ def test_difficultAdditionRemoval(self):
removals=[0, 1, 2, 9, 33],
additions=[(3, 1991), (34, 37132)]
)
self.__test_body(scenario)

def test_hardUpdate(self):
"""Make "random" removals and additions, then hard update."""
Expand Down

0 comments on commit a48a833

Please sign in to comment.