Beispiel #1
0
    def test_trailer_only(self):
        tree = self.make_branch_and_tree(".")
        self.build_tree_contents([
            ("debian/", ),
            (
                "debian/changelog",
                """\
lintian-brush (0.35) unstable; urgency=medium

  * This line already existed.

 --
""",
            ),
        ])
        tree.add(["debian", "debian/changelog"])
        self.overrideEnv("DEBFULLNAME", "Joe Example")
        self.overrideEnv("DEBEMAIL", "*****@*****.**")
        try:
            add_changelog_entry(tree, "debian/changelog",
                                ["And this one is new."])
        except ChangelogCreateError:
            self.skipTest("python-debian does not allow serializing changelog "
                          "with empty trailer")
        self.assertFileEqual(
            """\
lintian-brush (0.35) unstable; urgency=medium

  * This line already existed.
  * And this one is new.

 --
""",
            "debian/changelog",
        )
Beispiel #2
0
    def test_edit_existing_existing_author(self):
        tree = self.make_branch_and_tree(".")
        self.build_tree_contents([
            ("debian/", ),
            (
                "debian/changelog",
                """\
lintian-brush (0.35) UNRELEASED; urgency=medium

  * Support updating templated debian/control files that use cdbs
    template.

 -- Joe Example <*****@*****.**>  Fri, 04 Oct 2019 02:36:13 +0000
""",
            ),
        ])
        tree.add(["debian", "debian/changelog"])
        self.overrideEnv("DEBFULLNAME", "Joe Example")
        self.overrideEnv("DEBEMAIL", "*****@*****.**")
        add_changelog_entry(tree, "debian/changelog", ["Add a foo"])
        self.assertFileEqual(
            """\
lintian-brush (0.35) UNRELEASED; urgency=medium

  * Support updating templated debian/control files that use cdbs
    template.
  * Add a foo

 -- Joe Example <*****@*****.**>  Fri, 04 Oct 2019 02:36:13 +0000
""",
            "debian/changelog",
        )
Beispiel #3
0
    def test_add_new(self):
        tree = self.make_branch_and_tree(".")
        self.build_tree_contents([
            ("debian/", ),
            (
                "debian/changelog",
                """\
lintian-brush (0.35) unstable; urgency=medium

  * Support updating templated debian/control files that use cdbs
    template.

 -- Joe Example <*****@*****.**>  Fri, 04 Oct 2019 02:36:13 +0000
""",
            ),
        ])
        tree.add(["debian", "debian/changelog"])
        self.overrideEnv("DEBFULLNAME", "Jane Example")
        self.overrideEnv("DEBEMAIL", "*****@*****.**")
        self.overrideEnv("DEBCHANGE_VENDOR", "debian")
        add_changelog_entry(
            tree,
            "debian/changelog",
            ["Add a foo"],
            timestamp=datetime(2020, 5, 24, 15, 27, 26),
        )
        self.assertFileEqual(
            """\
lintian-brush (0.36) UNRELEASED; urgency=medium

  * Add a foo

 -- Jane Example <*****@*****.**>  Sun, 24 May 2020 15:27:26 -0000

lintian-brush (0.35) unstable; urgency=medium

  * Support updating templated debian/control files that use cdbs
    template.

 -- Joe Example <*****@*****.**>  Fri, 04 Oct 2019 02:36:13 +0000
""",
            "debian/changelog",
        )
Beispiel #4
0
    def test_add_long_subline(self):
        tree = self.make_branch_and_tree(".")
        self.build_tree_contents([
            ("debian/", ),
            (
                "debian/changelog",
                """\
lintian-brush (0.35) UNRELEASED; urgency=medium

  * Support updating templated debian/control files that use cdbs
    template.

 -- Joe Example <*****@*****.**>  Fri, 04 Oct 2019 02:36:13 +0000
""",
            ),
        ])
        tree.add(["debian", "debian/changelog"])
        self.overrideEnv("DEBFULLNAME", "Joe Example")
        self.overrideEnv("DEBEMAIL", "*****@*****.**")
        add_changelog_entry(
            tree,
            "debian/changelog",
            [
                "This is the main item.",
                "+ This is adding a very long sentence that is longer than "
                "would fit on a single line in a 80-character-wide line.",
            ],
        )
        self.assertFileEqual(
            """\
lintian-brush (0.35) UNRELEASED; urgency=medium

  * Support updating templated debian/control files that use cdbs
    template.
  * This is the main item.
    + This is adding a very long sentence that is longer than would fit on a
      single line in a 80-character-wide line.

 -- Joe Example <*****@*****.**>  Fri, 04 Oct 2019 02:36:13 +0000
""",
            "debian/changelog",
        )
Beispiel #5
0
    def test_edit_broken_first_line(self):
        tree = self.make_branch_and_tree(".")
        self.build_tree_contents([
            ("debian/", ),
            (
                "debian/changelog",
                """\
THIS IS NOT A PARSEABLE LINE
lintian-brush (0.35) UNRELEASED; urgency=medium

  * Support updating templated debian/control files that use cdbs
    template.

 -- Joe Example <*****@*****.**>  Fri, 04 Oct 2019 02:36:13 +0000
""",
            ),
        ])
        tree.add(["debian", "debian/changelog"])
        self.overrideEnv("DEBFULLNAME", "Jane Example")
        self.overrideEnv("DEBEMAIL", "*****@*****.**")
        add_changelog_entry(tree, "debian/changelog", ["Add a foo", "+ Bar"])
        self.assertFileEqual(
            """\
THIS IS NOT A PARSEABLE LINE
lintian-brush (0.35) UNRELEASED; urgency=medium

  [ Joe Example ]
  * Support updating templated debian/control files that use cdbs
    template.

  [ Jane Example ]
  * Add a foo
    + Bar

 -- Joe Example <*****@*****.**>  Fri, 04 Oct 2019 02:36:13 +0000
""",
            "debian/changelog",
        )