'``BuildPackage.run`` creates a .deb package from the supplied
``source_path``.'

@require_dpkg
def test_deb(self):

    destination_path = FilePath(self.mktemp())
    destination_path.makedirs()
    source_path = FilePath(self.mktemp())
    source_path.makedirs()
    source_path.child('Foo').touch()
    source_path.child('Bar').touch()
    expected_prefix = FilePath('/foo/bar')
    expected_paths = set([expected_prefix.child('Foo'), expected_prefix.child('Bar'), FilePath('/other/file')])
    expected_name = 'FooBar'.lower()
    expected_epoch = '3'
    expected_rpm_version = RPMVersion(version='0.3', release='0.dev.1')
    expected_license = 'My    Test    License'
    expected_url = 'https://www.example.com/foo/bar'
    expected_vendor = 'Acme    Corporation'
    expected_maintainer = 'noreply@example.com'
    expected_architecture = 'i386'
    expected_description = 'Explosive    Tennis    Balls'
    BuildPackage(package_type=PackageTypes.DEB, destination_path=destination_path, source_paths={source_path: FilePath('/foo/bar'), source_path.child('Foo'): FilePath('/other/file')}, name=expected_name, prefix=FilePath('/'), epoch=expected_epoch, rpm_version=expected_rpm_version, license=expected_license, url=expected_url, vendor=expected_vendor, maintainer=expected_maintainer, architecture=expected_architecture, description=expected_description, category='admin', dependencies=[Dependency(package='test-dep'), Dependency(package='version-dep', compare='>=', version='42')]).run()
    packages = glob('{}*.deb'.format(destination_path.child(expected_name.lower()).path))
    self.assertEqual(1, len(packages))
    expected_headers = dict(Package=expected_name, Version=((((expected_epoch + ':') + expected_rpm_version.version) + '-') + expected_rpm_version.release), License=expected_license, Vendor=expected_vendor, Architecture=expected_architecture, Maintainer=expected_maintainer, Homepage=expected_url, Depends=',    '.join(['test-dep', 'version-dep    (>=    42)']), Section='admin')
    assert_deb_headers(self, expected_headers, FilePath(packages[0]))
    assert_deb_content(self, expected_paths, FilePath(packages[0]))
