def test_bump_no_separator(self, workspace): content = dedent('''\ ## Dev - some changes ''') workspace.write('changelog', content) self.releaser.config.__getitem__.return_value = ObjectDict({ 'file': 'changelog', 'separator': '', 'bump': '## {version} {date:%Y-%m-%d}', 'prepare': '## Dev', 'empty': 'Empty', }) hook = ChangelogHook(self.releaser) hook.bump([]) expected = dedent('''\ ## 1.2.3 {0:%Y-%m-%d} - some changes ''').format(self.releaser.timestamp) self.releaser.perform.assert_called_once_with('changelog', content, expected)
def test_bump_no_separator(self, workspace): content = dedent("""\ ## Dev - some changes """) workspace.write("changelog", content) self.releaser.config.__getitem__.return_value = ObjectDict({ "file": "changelog", "separator": "", "bump": "## {version} {date:%Y-%m-%d}", "prepare": "## Dev", "empty": "Empty", }) hook = ChangelogHook(self.releaser) hook.bump([]) expected = dedent("""\ ## 1.2.3 {0:%Y-%m-%d} - some changes """).format(self.releaser.timestamp) self.releaser.perform.assert_called_once_with("changelog", content, expected)
def test_bump_no_separator(self, workspace): content = dedent('''\ ## Dev - some changes ''') workspace.write('changelog', content) self.releaser.config.__getitem__.return_value = ObjectDict({ 'file': 'changelog', 'separator': '', 'bump': '## {version} {date:%Y-%m-%d}', 'prepare': '## Dev', 'empty': 'Empty', }) hook = ChangelogHook(self.releaser) hook.bump([]) expected = dedent('''\ ## 1.2.3 {0:%Y-%m-%d} - some changes ''').format(self.releaser.timestamp) self.releaser.perform.assert_called_once_with('changelog', content, expected)
def test_bump(self): content = dedent('''\ Dev ### - some changes ''') with workspace() as wksp: with codecs.open('changelog', 'wb', encoding='utf8') as f: f.write(content) self.releaser.config.__getitem__.return_value = ObjectDict({ 'file': 'changelog', 'separator': '#', 'bump': '{version} {date:%Y-%m-%d}', 'prepare': 'Dev', 'empty': 'Empty', }) hook = ChangelogHook(self.releaser) hook.bump([]) expected = dedent('''\ 1.2.3 {0:%Y-%m-%d} ################ - some changes ''').format(self.releaser.timestamp) self.releaser.perform.assert_called_once_with('changelog', content, expected)
def test_bump(self): content = dedent('''\ Dev ### - some changes ''') with workspace() as wksp: with codecs.open('changelog', 'wb', encoding='utf8') as f: f.write(content) self.releaser.config.__getitem__.return_value = ObjectDict({ 'file': 'changelog', 'separator': '#', 'bump': '{version} {date:%Y-%m-%d}', 'prepare': 'Dev', 'empty': 'Empty', }) hook = ChangelogHook(self.releaser) hook.bump([]) expected = dedent('''\ 1.2.3 {0:%Y-%m-%d} ################ - some changes ''').format(self.releaser.timestamp) self.releaser.perform.assert_called_once_with( 'changelog', content, expected)