Skip to content

Commit

Permalink
Make config_settings_spec more future proof against new settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Stvad committed May 30, 2020
1 parent 82d86f7 commit a21388d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test/config/config_settings_spec.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import logging
from unittest.mock import MagicMock

from expects import expect, contain
from mamba import describe, it, context
from unittest.mock import MagicMock
from random import shuffle

from test_utils.anki import mock_anki_modules

Expand All @@ -11,7 +10,6 @@

from crowd_anki.config.config_settings import ConfigSettings, NoteSortingMethods


with describe(ConfigSettings) as self:
with context("someone interacts with any config setting"):
with it("do not sort / sort by none"):
Expand Down Expand Up @@ -87,12 +85,12 @@
"import_notes_ignore_deck_movement": True
}

config = ConfigSettings(addon_manager=addon_manager_mock, init_values=old_settings)
config = ConfigSettings(addon_manager_mock, old_settings, MagicMock())

for key in new_settings:
setattr(config, key, new_settings[key])

config.save()

assert config._config == new_settings
expect(config._config.items()).to(contain(*list(new_settings.items())))
addon_manager_mock.writeConfig.assert_called_once()

0 comments on commit a21388d

Please sign in to comment.