Exemplo n.º 1
0
    def test_write_inner_release(self):
        dest = LazyWriter(pjoin(self.work_dir, 'Release'))
        self.writer.write(dest, 'main', 'i386')
        dest.close()
        expected = """Archive: stable
Version: 3.0r4
Component: main
Origin: Debian
Label: Debian2
Architecture: i386
"""
        actual = self.read_file('Release')
        self.assert_equals_long(expected, actual)
Exemplo n.º 2
0
    def test_writer_outer_release(self):
        handle = LazyWriter(pjoin(self.search_path, 'data', 'Release'))
        print >> handle, 'testing123'
        handle.close()

        release_path = pjoin(self.search_path, 'Release')
        release_handle = LazyWriter(release_path)
        self.writer.write_outer(release_handle)
        release_handle.close()

        expected_release = """Origin: Debian
Label: Debian2
Suite: happy
Version: 3.0r4
Codename: woody
Date: Wed, 22 Mar 2005 21:20:00 UTC
Architectures: alpha i386
Components: main contrib
Description: Hello World!
MD5Sum:
 bad9425ff652b1bd52b49720abecf0ba               11 data/Release
SHA1:
 e3dc8362c1586e4d9702ad862f29b6bef869afde               11 data/Release
"""
        actual_release = self.read_file(release_path)
        # Newer versions of apt-ftparchive put more sums after the file.
        # We'll overlook these for now, for compatibility purposes.
        edited_release = ''.join(actual_release.splitlines(True)[:13])
        self.assert_equals_long(expected_release, edited_release)
Exemplo n.º 3
0
 def test_lazy_writer(self):
     full_name = pjoin(self.repo.tmp_dir, 'asdf')
     handle = LazyWriter(full_name)
     print >> handle, 'hello'
     handle.close()
     self.fail_unless(os.path.exists(full_name))
     handle = open(full_name)
     self.assert_equal("hello\n", handle.read())
     handle.close()