Skip to content

Commit

Permalink
Merge pull request #262 from quarckster/fix-sorting
Browse files Browse the repository at this point in the history
Fix sorting
  • Loading branch information
quarckster authored Feb 16, 2023
2 parents 06c46a3 + 0fe7d7a commit 988816d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@
<default>desc</default>
<constraints>
<options>
<option label="32067">asc</option>
<option label="32068">desc</option>
<option label="32067">desc</option>
<option label="32068">asc</option>
</options>
</constraints>
<control type="list" format="string">
Expand Down
10 changes: 10 additions & 0 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ def test_settings_locs(monkeypatch, loc, settings_mod):
monkeypatch.setattr(settings_mod.xbmcaddon, "Addon", addon_mock_class)
settings = settings_mod.Settings()
assert settings.loc == loc


@pytest.mark.parametrize("direction", ["asc", "desc"])
def test_settings_sorting_direction_param(monkeypatch, direction, settings_mod):
addon_mock = MagicMock()
addon_mock.getSetting = MagicMock(return_value=direction)
addon_mock_class = MagicMock(return_value=addon_mock)
monkeypatch.setattr(settings_mod.xbmcaddon, "Addon", addon_mock_class)
settings = settings_mod.Settings()
assert settings.sorting_direction_param == "" if direction == "asc" else "-"

0 comments on commit 988816d

Please sign in to comment.