def setUp(self, mocker): self.releaser = mocker.MagicMock() self.releaser.version = Version.parse("1.2.3") self.releaser.config.__getitem__.return_value = ObjectDict({ "bump": "bump command", "prepare": "prepare command", }) self.releaser.config.verbose = False self.releaser.config.dryrun = False self.hook = CommandsHook(self.releaser)
def setUp(self): self.releaser = MagicMock() self.releaser.version = Version.parse('1.2.3') self.releaser.config.__getitem__.return_value = ObjectDict({ 'bump': 'bump command', 'prepare': 'prepare command', }) self.releaser.config.verbose = False self.releaser.config.dryrun = False self.hook = CommandsHook(self.releaser)
class CommandsHookTest(object): @pytest.fixture(autouse=True) def setUp(self, mocker): self.releaser = mocker.MagicMock() self.releaser.version = Version.parse('1.2.3') self.releaser.config.__getitem__.return_value = ObjectDict({ 'bump': 'bump command', 'prepare': 'prepare command', }) self.releaser.config.verbose = False self.releaser.config.dryrun = False self.hook = CommandsHook(self.releaser) def test_bump(self, mocker): execute = mocker.patch('bumpr.hooks.execute') self.hook.bump([]) execute.assert_called_once_with('bump command', replacements=mocker.ANY, verbose=mocker.ANY, dryrun=False) def test_prepare(self, mocker): execute = mocker.patch('bumpr.hooks.execute') self.hook.prepare([]) execute.assert_called_once_with('prepare command', replacements=mocker.ANY, verbose=mocker.ANY, dryrun=False) def test_bump_dryrun(self, mocker): execute = mocker.patch('bumpr.hooks.execute') self.hook.dryrun = True self.hook.bump([]) execute.assert_called_once_with('bump command', replacements=mocker.ANY, verbose=mocker.ANY, dryrun=True) def test_prepare_dryrun(self, mocker): execute = mocker.patch('bumpr.hooks.execute') self.hook.dryrun = True self.hook.prepare([]) execute.assert_called_once_with('prepare command', replacements=mocker.ANY, verbose=mocker.ANY, dryrun=True)
class CommandsHookTest(unittest.TestCase): def setUp(self): self.releaser = MagicMock() self.releaser.version = Version.parse('1.2.3') self.releaser.config.__getitem__.return_value = ObjectDict({ 'bump': 'bump command', 'prepare': 'prepare command', }) self.releaser.config.verbose = False self.releaser.config.dryrun = False self.hook = CommandsHook(self.releaser) def test_bump(self, execute): self.hook.bump([]) execute.assert_called_once_with('bump command', replacements=ANY, verbose=ANY, dryrun=False) def test_prepare(self, execute): self.hook.prepare([]) execute.assert_called_once_with('prepare command', replacements=ANY, verbose=ANY, dryrun=False) def test_bump_dryrun(self, execute): self.hook.dryrun = True self.hook.bump([]) execute.assert_called_once_with('bump command', replacements=ANY, verbose=ANY, dryrun=True) def test_prepare_dryrun(self, execute): self.hook.dryrun = True self.hook.prepare([]) execute.assert_called_once_with('prepare command', replacements=ANY, verbose=ANY, dryrun=True)
def setUp(self, mocker): self.releaser = mocker.MagicMock() self.releaser.version = Version.parse('1.2.3') self.releaser.config.__getitem__.return_value = ObjectDict({ 'bump': 'bump command', 'prepare': 'prepare command', }) self.releaser.config.verbose = False self.releaser.config.dryrun = False self.hook = CommandsHook(self.releaser)
class CommandsHookTest: @pytest.fixture(autouse=True) def setUp(self, mocker): self.releaser = mocker.MagicMock() self.releaser.version = Version.parse("1.2.3") self.releaser.config.__getitem__.return_value = ObjectDict({ "bump": "bump command", "prepare": "prepare command", }) self.releaser.config.verbose = False self.releaser.config.dryrun = False self.hook = CommandsHook(self.releaser) def test_bump(self, mocker): execute = mocker.patch("bumpr.hooks.execute") self.hook.bump([]) execute.assert_called_once_with("bump command", replacements=mocker.ANY, verbose=mocker.ANY, dryrun=False) def test_prepare(self, mocker): execute = mocker.patch("bumpr.hooks.execute") self.hook.prepare([]) execute.assert_called_once_with("prepare command", replacements=mocker.ANY, verbose=mocker.ANY, dryrun=False) def test_bump_dryrun(self, mocker): execute = mocker.patch("bumpr.hooks.execute") self.hook.dryrun = True self.hook.bump([]) execute.assert_called_once_with("bump command", replacements=mocker.ANY, verbose=mocker.ANY, dryrun=True) def test_prepare_dryrun(self, mocker): execute = mocker.patch("bumpr.hooks.execute") self.hook.dryrun = True self.hook.prepare([]) execute.assert_called_once_with("prepare command", replacements=mocker.ANY, verbose=mocker.ANY, dryrun=True)