~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/archiveuploader/tests/test_utils.py

  • Committer: Christian Reis
  • Date: 2007-05-04 17:48:03 UTC
  • mto: This revision was merged to the branch mainline in revision 4206.
  • Revision ID: christian.reis@canonical.com-20070504174803-ij77q4jwkm5l8mbk
Break apart upload code into canonical/archiveuploader

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
import unittest
8
8
import sys
9
9
import shutil
10
 
from canonical.archivepublisher.tests import datadir
 
10
from canonical.archiveuploader.tests import datadir
11
11
 
12
12
 
13
13
class TestUtilities(unittest.TestCase):
14
14
 
15
15
    def testImport(self):
16
 
        """canonical.archivepublisher.utils should be importable"""
17
 
        import canonical.archivepublisher.utils
 
16
        """canonical.archiveuploader.utils should be importable"""
 
17
        import canonical.archiveuploader.utils
18
18
 
19
19
    def testPrefixMultilineString(self):
20
 
        """canonical.archivepublisher.utils.prefix_multi_line_string should work"""
21
 
        from canonical.archivepublisher.utils import prefix_multi_line_string
 
20
        """canonical.archiveuploader.utils.prefix_multi_line_string should work"""
 
21
        from canonical.archiveuploader.utils import prefix_multi_line_string
22
22
        self.assertEquals("A:foo\nA:bar",
23
23
                          prefix_multi_line_string("foo\nbar", "A:"))
24
24
        self.assertEquals("A:foo\nA:bar",
27
27
                          prefix_multi_line_string("foo\n\nbar", "A:", 1))
28
28
 
29
29
    def testExtractComponent(self):
30
 
        """canonical.archivepublisher.utils.extract_component_from_section should work
 
30
        """canonical.archiveuploader.utils.extract_component_from_section should work
31
31
        """
32
 
        from canonical.archivepublisher.utils import extract_component_from_section
 
32
        from canonical.archiveuploader.utils import extract_component_from_section
33
33
 
34
34
        (sect, comp) = extract_component_from_section("libs")
35
35
        self.assertEquals(sect, "libs")
49
49
        self.assertEquals(comp, "restricted")
50
50
 
51
51
    def testBuildFileListFromChanges(self):
52
 
        """canonical.archivepublisher.utils.build_file_list should be capable of
 
52
        """canonical.archiveuploader.utils.build_file_list should be capable of
53
53
           reading changes files
54
54
        """
55
 
        from canonical.archivepublisher.utils import build_file_list
56
 
        from canonical.archivepublisher.tagfiles import parse_tagfile
 
55
        from canonical.archiveuploader.utils import build_file_list
 
56
        from canonical.archiveuploader.tagfiles import parse_tagfile
57
57
 
58
58
        ch = parse_tagfile(datadir("good-signed-changes"))
59
59
        fl = build_file_list(ch)
60
60
        self.assertEquals("abiword_2.0.10-1.2_mips.deb" in fl, True)
61
61
 
62
62
    def testFixMaintainerOkay(self):
63
 
        """canonical.archivepublisher.utils.fix_maintainer should parse correct values
 
63
        """canonical.archiveuploader.utils.fix_maintainer should parse correct values
64
64
        """
65
 
        from canonical.archivepublisher.utils import fix_maintainer
 
65
        from canonical.archiveuploader.utils import fix_maintainer
66
66
        cases = (
67
67
            ("No\xc3\xa8l K\xc3\xb6the <noel@debian.org>",
68
68
             "No\xc3\xa8l K\xc3\xb6the <noel@debian.org>",
133
133
            self.assertEquals(case[4], d)
134
134
 
135
135
    def testFixMaintainerRaises(self):
136
 
        """canonical.archivepublisher.utils.fix_maintainer should raise on incorrect
 
136
        """canonical.archiveuploader.utils.fix_maintainer should raise on incorrect
137
137
           values
138
138
        """
139
 
        from canonical.archivepublisher.utils import fix_maintainer, ParseMaintError
 
139
        from canonical.archiveuploader.utils import fix_maintainer, ParseMaintError
140
140
        cases = (
141
141
            "James Troup",
142
142
            "James Troup <james>",