class TestPatchInfo(unittest.TestCase):
    def setUp(self):
        self.work_dir = 'work_dir'
        self.file_exclusion_list = ['channel-prefs.js','update.manifest','updatev2.manifest','removed-files']
        self.path_exclusion_list = ['/readme.txt']
        self.patch_info = PatchInfo(self.work_dir, self.file_exclusion_list, self.path_exclusion_list)

    def testPatchInfo(self):
        self.assertEquals(self.work_dir, self.patch_info.work_dir)
        self.assertEquals([], self.patch_info.archive_files)
        self.assertEquals([], self.patch_info.manifestv1)
        self.assertEquals([], self.patch_info.manifestv2)
        self.assertEquals(self.file_exclusion_list, self.patch_info.file_exclusion_list)
        self.assertEquals(self.path_exclusion_list, self.patch_info.path_exclusion_list)

    def test_append_add_instruction(self):
        self.patch_info.append_add_instruction('file.test')
        self.assertEquals(['add "file.test"'], self.patch_info.manifestv1)

    def test_append_patch_instruction(self):
        self.patch_info.append_patch_instruction('file.test', 'patchname')
        self.assertEquals(['patch "patchname" "file.test"'], self.patch_info.manifestv1)

    """ FIXME touches the filesystem, need refactoring
    def test_append_remove_instruction(self):
        self.patch_info.append_remove_instruction('file.test')
        self.assertEquals(['remove "file.test"'], self.patch_info.manifestv1)

    def test_create_manifest_file(self):
        self.patch_info.create_manifest_file()
    """

    def test_build_marfile_entry_hash(self):
        self.assertEquals(({}, set([]), set([])), self.patch_info.build_marfile_entry_hash('root_path'))
class TestPatchInfo(unittest.TestCase):
    def setUp(self):
        self.work_dir = 'work_dir'
        self.file_exclusion_list = [
            'channel-prefs.js', 'update.manifest', 'updatev2.manifest',
            'removed-files'
        ]
        self.path_exclusion_list = ['/readme.txt']
        self.patch_info = PatchInfo(self.work_dir, self.file_exclusion_list,
                                    self.path_exclusion_list)

    def testPatchInfo(self):
        self.assertEquals(self.work_dir, self.patch_info.work_dir)
        self.assertEquals([], self.patch_info.archive_files)
        self.assertEquals([], self.patch_info.manifestv1)
        self.assertEquals([], self.patch_info.manifestv2)
        self.assertEquals(self.file_exclusion_list,
                          self.patch_info.file_exclusion_list)
        self.assertEquals(self.path_exclusion_list,
                          self.patch_info.path_exclusion_list)

    def test_append_add_instruction(self):
        self.patch_info.append_add_instruction('file.test')
        self.assertEquals(['add "file.test"'], self.patch_info.manifestv1)

    def test_append_patch_instruction(self):
        self.patch_info.append_patch_instruction('file.test', 'patchname')
        self.assertEquals(['patch "patchname" "file.test"'],
                          self.patch_info.manifestv1)

    """ FIXME touches the filesystem, need refactoring
    def test_append_remove_instruction(self):
        self.patch_info.append_remove_instruction('file.test')
        self.assertEquals(['remove "file.test"'], self.patch_info.manifestv1)

    def test_create_manifest_file(self):
        self.patch_info.create_manifest_file()
    """

    def test_build_marfile_entry_hash(self):
        self.assertEquals(
            ({}, set([]), set([])),
            self.patch_info.build_marfile_entry_hash('root_path'))
예제 #3
0
class TestPatchInfo(unittest.TestCase):
    def setUp(self):
        self.work_dir = 'work_dir'
        self.file_exclusion_list = [
            'update.manifest', 'updatev2.manifest', 'updatev3.manifest'
        ]
        self.path_exclusion_list = ['/readme.txt']
        self.patch_info = PatchInfo(self.work_dir, self.file_exclusion_list,
                                    self.path_exclusion_list)

    def testPatchInfo(self):
        self.assertEquals(self.work_dir, self.patch_info.work_dir)
        self.assertEquals([], self.patch_info.archive_files)
        self.assertEquals([], self.patch_info.manifestv2)
        self.assertEquals([], self.patch_info.manifestv3)
        self.assertEquals(self.file_exclusion_list,
                          self.patch_info.file_exclusion_list)
        self.assertEquals(self.path_exclusion_list,
                          self.patch_info.path_exclusion_list)

    def test_append_add_instruction(self):
        self.patch_info.append_add_instruction('file.test')
        self.assertEquals(['add "file.test"'], self.patch_info.manifestv2)
        self.assertEquals(['add "file.test"'], self.patch_info.manifestv3)

    def test_append_add_if_instruction(self):
        self.patch_info.append_add_instruction(
            'distribution/extensions/extension/file.test')
        self.assertEquals([
            'add-if "distribution/extensions/extension" "distribution/extensions/extension/file.test"'
        ], self.patch_info.manifestv2)
        self.assertEquals([
            'add-if "distribution/extensions/extension" "distribution/extensions/extension/file.test"'
        ], self.patch_info.manifestv3)

    def test_append_add_if_not_instruction(self):
        self.patch_info.append_add_if_not_instruction('file.test')
        self.assertEquals([], self.patch_info.manifestv2)
        self.assertEquals(['add-if-not "file.test" "file.test"'],
                          self.patch_info.manifestv3)

    def test_append_patch_instruction(self):
        self.patch_info.append_patch_instruction('file.test', 'patchname')
        self.assertEquals(['patch "patchname" "file.test"'],
                          self.patch_info.manifestv2)
        self.assertEquals(['patch "patchname" "file.test"'],
                          self.patch_info.manifestv3)

    def test_append_patch_if_instruction(self):
        self.patch_info.append_patch_instruction(
            'distribution/extensions/extension/file.test', 'patchname')
        self.assertEquals([
            'patch-if "distribution/extensions/extension" "patchname" "distribution/extensions/extension/file.test"'
        ], self.patch_info.manifestv2)
        self.assertEquals([
            'patch-if "distribution/extensions/extension" "patchname" "distribution/extensions/extension/file.test"'
        ], self.patch_info.manifestv3)

    def test_append_remove_instruction(self):
        self.patch_info.append_remove_instruction('file.test')
        self.assertEquals(['remove "file.test"'], self.patch_info.manifestv2)
        self.assertEquals(['remove "file.test"'], self.patch_info.manifestv3)

    def test_append_rmdir_instruction(self):
        self.patch_info.append_remove_instruction('dirtest/')
        self.assertEquals(['rmdir "dirtest/"'], self.patch_info.manifestv2)
        self.assertEquals(['rmdir "dirtest/"'], self.patch_info.manifestv3)

    def test_append_rmrfdir_instruction(self):
        self.patch_info.append_remove_instruction('dirtest/*')
        self.assertEquals(['rmrfdir "dirtest/"'], self.patch_info.manifestv2)
        self.assertEquals(['rmrfdir "dirtest/"'], self.patch_info.manifestv3)

    """ FIXME touches the filesystem, need refactoring
    def test_create_manifest_file(self):
        self.patch_info.create_manifest_file()
    """

    def test_build_marfile_entry_hash(self):
        self.assertEquals(
            ({}, set([]), set([])),
            self.patch_info.build_marfile_entry_hash('root_path'))
class TestPatchInfo(unittest.TestCase):
    def setUp(self):
        self.work_dir = 'work_dir'
        self.file_exclusion_list = ['update.manifest','updatev2.manifest','updatev3.manifest','removed-files']
        self.path_exclusion_list = ['/readme.txt']
        self.patch_info = PatchInfo(self.work_dir, self.file_exclusion_list, self.path_exclusion_list)

    def testPatchInfo(self):
        self.assertEquals(self.work_dir, self.patch_info.work_dir)
        self.assertEquals([], self.patch_info.archive_files)
        self.assertEquals([], self.patch_info.manifestv2)
        self.assertEquals([], self.patch_info.manifestv3)
        self.assertEquals(self.file_exclusion_list, self.patch_info.file_exclusion_list)
        self.assertEquals(self.path_exclusion_list, self.patch_info.path_exclusion_list)

    def test_append_add_instruction(self):
        self.patch_info.append_add_instruction('file.test')
        self.assertEquals(['add "file.test"'], self.patch_info.manifestv2)
        self.assertEquals(['add "file.test"'], self.patch_info.manifestv3)

    def test_append_add_if_instruction(self):
        self.patch_info.append_add_instruction('distribution/extensions/extension/file.test')
        self.assertEquals(['add-if "distribution/extensions/extension" "distribution/extensions/extension/file.test"'], self.patch_info.manifestv2)
        self.assertEquals(['add-if "distribution/extensions/extension" "distribution/extensions/extension/file.test"'], self.patch_info.manifestv3)

    def test_append_add_if_not_instruction(self):
        self.patch_info.append_add_if_not_instruction('file.test')
        self.assertEquals([], self.patch_info.manifestv2)
        self.assertEquals(['add-if-not "file.test" "file.test"'], self.patch_info.manifestv3)

    def test_append_patch_instruction(self):
        self.patch_info.append_patch_instruction('file.test', 'patchname')
        self.assertEquals(['patch "patchname" "file.test"'], self.patch_info.manifestv2)
        self.assertEquals(['patch "patchname" "file.test"'], self.patch_info.manifestv3)

    def test_append_patch_if_instruction(self):
        self.patch_info.append_patch_instruction('distribution/extensions/extension/file.test', 'patchname')
        self.assertEquals(['patch-if "distribution/extensions/extension" "patchname" "distribution/extensions/extension/file.test"'], self.patch_info.manifestv2)
        self.assertEquals(['patch-if "distribution/extensions/extension" "patchname" "distribution/extensions/extension/file.test"'], self.patch_info.manifestv3)

    def test_append_remove_instruction(self):
        self.patch_info.append_remove_instruction('file.test')
        self.assertEquals(['remove "file.test"'], self.patch_info.manifestv2)
        self.assertEquals(['remove "file.test"'], self.patch_info.manifestv3)

    def test_append_rmdir_instruction(self):
        self.patch_info.append_remove_instruction('dirtest/')
        self.assertEquals(['rmdir "dirtest/"'], self.patch_info.manifestv2)
        self.assertEquals(['rmdir "dirtest/"'], self.patch_info.manifestv3)

    def test_append_rmrfdir_instruction(self):
        self.patch_info.append_remove_instruction('dirtest/*')
        self.assertEquals(['rmrfdir "dirtest/"'], self.patch_info.manifestv2)
        self.assertEquals(['rmrfdir "dirtest/"'], self.patch_info.manifestv3)

    """ FIXME touches the filesystem, need refactoring
    def test_create_manifest_file(self):
        self.patch_info.create_manifest_file()
    """

    def test_build_marfile_entry_hash(self):
        self.assertEquals(({}, set([]), set([])), self.patch_info.build_marfile_entry_hash('root_path'))