bh@127: # Copyright (C) 2008 by Intevation GmbH bh@127: # Authors: bh@127: # Bernhard Herzog bh@127: # bh@127: # This program is free software under the GPL (>=v2) bh@127: # Read the file COPYING coming with the software for details. bh@127: bh@127: """Tests for treepkg.debian""" bh@127: bh@127: import unittest bh@127: bh@127: from filesupport import FileTestMixin bh@127: bh@127: from treepkg.debian import DebianControlFile bh@127: bh@127: bh@127: class TestDebianControlFile(unittest.TestCase, FileTestMixin): bh@127: bh@127: control_contents = """\ bh@127: Source: libksba bh@127: Section: libs bh@127: Priority: optional bh@127: Maintainer: Kolab-Konsortium Packager bh@127: Uploaders: Removed for the test bh@127: Build-Depends: debhelper (>= 4.2), libgpg-error-dev (>= 1.2), bison, autotools-dev, cdbs bh@127: Standards-Version: 3.7.2 bh@127: bh@127: Package: libksba-dev bh@127: Section: libdevel bh@127: Architecture: any bh@127: Depends: libksba8 (>= ${Source-Version}) bh@127: Replaces: libksba0 bh@127: Description: Test description bh@127: Some more text. bh@127: . bh@127: Development library files. bh@127: bh@127: Package: libksba8 bh@127: Section: libs bh@127: Architecture: any bh@127: Depends: ${shlibs:Depends}, ${misc:Depends} bh@127: Description: Test description bh@127: Some more text. bh@127: . bh@127: Runtime library files. bh@127: """ bh@127: bh@127: def test(self): bh@127: filename = self.create_temp_file(self.id() + "-control", bh@127: self.control_contents) bh@127: parsed = DebianControlFile(filename) bh@127: self.assertEquals(parsed.packages, bh@127: [('libksba-dev', 'any'), ('libksba8', 'any')]) bh@127: self.assertEquals(parsed.build_depends, bh@127: ['debhelper', 'libgpg-error-dev', 'bison', bh@127: 'autotools-dev', 'cdbs'])