Пример #1
0
    def test_prepare_no_separator(self, workspace):
        content = dedent('''\
            ## 1.2.3 {0:%Y-%m-%d}

            - some changes
        ''').format(self.releaser.timestamp)

        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.prepare([])

        expected = dedent('''\
            ## Dev

            - Empty

            ## 1.2.3 {0:%Y-%m-%d}

            - some changes
        ''').format(self.releaser.timestamp)

        self.releaser.perform.assert_called_once_with('changelog', content, expected)
Пример #2
0
    def test_prepare(self):
        content = dedent('''\
            1.2.3 {0:%Y-%m-%d}
            ################

            - some changes
        ''').format(self.releaser.timestamp)

        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.prepare([])

            expected = dedent('''\
                Dev
                ###

                - Empty

                1.2.3 {0:%Y-%m-%d}
                ################

                - some changes
            ''').format(self.releaser.timestamp)

            self.releaser.perform.assert_called_once_with(
                'changelog', content, expected)
Пример #3
0
    def test_prepare(self, workspace):
        content = dedent("""\
            1.2.3 {0:%Y-%m-%d}
            ################

            - some changes
        """).format(self.releaser.timestamp)

        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.prepare([])

        expected = dedent("""\
            Dev
            ###

            - Empty

            1.2.3 {0:%Y-%m-%d}
            ################

            - some changes
        """).format(self.releaser.timestamp)

        self.releaser.perform.assert_called_once_with("changelog", content,
                                                      expected)
Пример #4
0
    def test_prepare_no_separator(self, workspace):
        content = dedent('''\
            ## 1.2.3 {0:%Y-%m-%d}

            - some changes
        ''').format(self.releaser.timestamp)

        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.prepare([])

        expected = dedent('''\
            ## Dev

            - Empty

            ## 1.2.3 {0:%Y-%m-%d}

            - some changes
        ''').format(self.releaser.timestamp)

        self.releaser.perform.assert_called_once_with('changelog', content,
                                                      expected)
Пример #5
0
    def test_prepare(self):
        content = dedent('''\
            1.2.3 {0:%Y-%m-%d}
            ################

            - some changes
        ''').format(self.releaser.timestamp)

        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.prepare([])

            expected = dedent('''\
                Dev
                ###

                - Empty

                1.2.3 {0:%Y-%m-%d}
                ################

                - some changes
            ''').format(self.releaser.timestamp)

            self.releaser.perform.assert_called_once_with('changelog', content, expected)