Пример #1
0
class TestGitWorkingCopy(unittest.TestCase, BaseTestWorkingCopy):
    def setUp(self):
        self.repository_path = os.path.join(example_repositories, "git")
        os.symlink("%s/git" % self.repository_path,
                   "%s/.git" % self.repository_path)
        self.repos = GitRepository(self.repository_path)
        self.tmpdir = tempfile.mkdtemp()
        self.repos.checkout(self.tmpdir)
        self.wc = GitWorkingCopy(self.tmpdir)
        self.latest_version = "38598c93c7036a1c44bbb6075517243edfa88860"
        self.previous_version = "3491ce1d9a66abc9d49d5844ee05167c6a854ad9"

    def tearDown(self):
        os.unlink("%s/.git" % self.repository_path)
        shutil.rmtree(self.tmpdir)

    def test__script_content(self):
        self.assertEqual(self.wc.content(self.latest_version, 'wrong.py'),
                         'File content not found.')
        path_to_project = os.path.join(this_directory, os.pardir,
                                       "example_projects", "python")
        for filename in ['default.param', 'romans.param']:
            with open(os.path.join(path_to_project, filename), 'r') as f:
                lines = f.readlines()
                self.assertEqual(
                    self.wc.content(self.latest_version, filename),
                    ''.join(lines)[:-1])
Пример #2
0
class TestGitWorkingCopy(unittest.TestCase, BaseTestWorkingCopy):

    def setUp(self):
        self.repository_path = os.path.join(example_repositories, "git")
        os.symlink("%s/git" % self.repository_path, "%s/.git" % self.repository_path)
        self.repos = GitRepository(self.repository_path)
        self.tmpdir = tempfile.mkdtemp()
        self.repos.checkout(self.tmpdir)
        self.wc = GitWorkingCopy(self.tmpdir)
        self.latest_version = "38598c93c7036a1c44bbb6075517243edfa88860"
        self.previous_version = "3491ce1d9a66abc9d49d5844ee05167c6a854ad9"

    def tearDown(self):
        os.unlink("%s/.git" % self.repository_path)
        shutil.rmtree(self.tmpdir)
Пример #3
0
class TestGitWorkingCopy(unittest.TestCase, BaseTestWorkingCopy):

    def setUp(self):
        self.repository_path = os.path.join(example_repositories, "git")
        os.symlink("%s/git" % self.repository_path, "%s/.git" % self.repository_path)
        self.repos = GitRepository(self.repository_path)
        self.tmpdir = tempfile.mkdtemp()
        self.repos.checkout(self.tmpdir)
        self.wc = GitWorkingCopy(self.tmpdir)
        self.latest_version = "38598c93c7036a1c44bbb6075517243edfa88860"
        self.previous_version = "3491ce1d9a66abc9d49d5844ee05167c6a854ad9"

    def tearDown(self):
        os.unlink("%s/.git" % self.repository_path)
        shutil.rmtree(self.tmpdir)

    def test__script_content(self):
        self.assertEqual(self.wc.content(self.latest_version, 'wrong.py'), 'File content not found.')
        path_to_project = os.path.join(this_directory, os.pardir, "example_projects", "python")
        for filename in ['default.param','romans.param']:
            with open(os.path.join(path_to_project, filename), 'r') as f:
                lines = f.readlines()
                self.assertEqual(self.wc.content(self.latest_version, filename), ''.join(lines))