def test_render_changelog_with_a_single_entry(self): ctx = self._get_mock_context() ctx.znake.info.changelog = [{ 'version': '0.0.1', 'changes': [ 'first release', ], 'date': 'Wed, 14 Feb 2018 12:00:00 +0000' }] result = _render_changelog_file(ctx) self.assertEqual( result, dedent("""\ my_package (0.0.1) unstable; urgency=low * first release -- nfsguy87 <*****@*****.**> Wed, 14 Feb 2018 12:00:00 +0000""" ))
def test_render_changelog_with_multiple_enties(self): ctx = self._get_mock_context() ctx.znake.info.changelog = [{ 'version': '0.0.2', 'changes': [ 'performance improvements', 'fix stale mount issue', ], 'date': 'Thu, 15 Feb 2018 12:00:00 +0000' }, { 'version': '0.0.1', 'changes': [ 'first release', ], 'date': 'Wed, 14 Feb 2018 12:00:00 +0000' }] result = _render_changelog_file(ctx) self.assertEqual( result, dedent("""\ my_package (0.0.2) unstable; urgency=low * performance improvements * fix stale mount issue -- nfsguy87 <*****@*****.**> Thu, 15 Feb 2018 12:00:00 +0000 my_package (0.0.1) unstable; urgency=low * first release -- nfsguy87 <*****@*****.**> Wed, 14 Feb 2018 12:00:00 +0000""" ))
def test_raises_exception_if_changelog_is_empty(self): ctx = Mock() ctx.znake.info.changelog = None with self.assertRaisesRegex(Exception, 'Changelog must not be empty'): _render_changelog_file(ctx)