Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
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)
Esempio n. 4
0
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)
Esempio n. 5
0
 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)
Esempio n. 6
0
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)
Esempio n. 7
0
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)