31_test_uscan.py 1.57 KB
Newer Older
Guido Günther's avatar
Guido Günther committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
# vim: set fileencoding=utf-8 :

"""Test L{gbp.deb}"""

from . import context  # noqa: 401
from . import testutils

import unittest

from gbp.deb.uscan import Uscan


class TestUscan(unittest.TestCase):
    """Test L{gbp.deb.uscan}"""

    uscan_ok = b"""<dehs>
uscan: Newest version of virt-what on remote site is 1.18, local version is 1.15
uscan:    => Newer package available from
      https://people.redhat.com/~rjones/virt-what/files/virt-what-1.18.tar.gz
gpgv: Signature made Mo 31 Jul 2017 11:36:08 ADT
gpgv:                using RSA key 91738F73E1B768A0
gpgv: Good signature from "Richard W.M. Jones <rjones@redhat.com>"
gpgv:                 aka "Richard W.M. Jones <rich@annexia.org>"
<package>virt-what</package>
<debian-uversion>1.15</debian-uversion>
<debian-mangled-uversion>1.15</debian-mangled-uversion>
<upstream-version>1.18</upstream-version>
<upstream-url>https://people.redhat.com/~rjones/virt-what/files/virt-what-1.18.tar.gz</upstream-url>
<status>newer package available</status>
<target>virt-what_1.18.orig.tar.gz</target>
<target-path>../virt-what_1.18.orig.tar.gz</target-path>
<messages>Not downloading, using existing file: virt-what-1.18.tar.gz
</messages>
<messages>Leaving ../virt-what_1.18.orig.tar.gz where it is.
</messages>
</dehs>"""

    @testutils.patch_popen(stdout=uscan_ok, stderr=b'', returncode=0)
    def test_uscan(self, uscan_mock):
        """Test parsing a valid uscan file"""
        uscan = Uscan()
42
        self.assertTrue(uscan.scan())
Guido Günther's avatar
Guido Günther committed
43 44
        self.assertFalse(uscan.uptodate)
        self.assertEquals(uscan.tarball, '../virt-what_1.18.orig.tar.gz')