Beispiel #1
0
class GitRepositoryTest(TestCase):
    def setUp(self):
        self.tmpdir = TemporaryDirectory()
        self.repo1 = GitRepository(
            self.tmpdir.name,
            url="https://github.com/st-tu-dresden/inloop.git",
            branch="master"
        )
        self.repo2 = GitRepository(
            self.tmpdir.name,
            url="https://github.com/st-tu-dresden/inloop-java-repository-example.git",
            branch="master"
        )

    def tearDown(self):
        self.tmpdir.cleanup()

    def test_git_operations(self):
        self.repo1.synchronize()
        self.assertTrue(self.get_path(".git").exists())
        self.assertTrue(self.get_path("manage.py").exists())
        self.assertEqual(b"", self.run_command("git status -s"))

        self.repo2.synchronize()
        self.assertFalse(self.get_path("manage.py").exists())
        self.assertTrue(self.get_path("build.xml").exists())
        self.assertEqual(b"", self.run_command("git status -s"))

    def get_path(self, name):
        return Path(self.tmpdir.name).joinpath(name)

    def run_command(self, command):
        return check_output(command.split(), cwd=self.tmpdir.name)
Beispiel #2
0
class GitRepositoryTest(TestCase):
    def setUp(self):
        self.tmpdir = TemporaryDirectory()
        self.repo1 = GitRepository(
            self.tmpdir.name,
            url='https://github.com/st-tu-dresden/inloop.git',
            branch='main')
        self.repo2 = GitRepository(
            self.tmpdir.name,
            url=
            'https://github.com/st-tu-dresden/inloop-java-repository-example.git',
            branch='main')

    def tearDown(self):
        self.tmpdir.cleanup()

    def test_git_operations(self):
        self.repo1.synchronize()
        self.assertTrue(self.get_path('.git').exists())
        self.assertTrue(self.get_path('manage.py').exists())
        self.assertEqual(b'', self.run_command('git status -s'))

        self.repo2.synchronize()
        self.assertFalse(self.get_path('manage.py').exists())
        self.assertTrue(self.get_path('build.xml').exists())
        self.assertEqual(b'', self.run_command('git status -s'))

    def get_path(self, name):
        return Path(self.tmpdir.name, name)

    def run_command(self, command):
        return check_output(command.split(), cwd=self.tmpdir.name)
Beispiel #3
0
 def setUp(self):
     self.tmpdir = TemporaryDirectory()
     self.repo1 = GitRepository(
         self.tmpdir.name,
         url='https://github.com/st-tu-dresden/inloop.git',
         branch='main')
     self.repo2 = GitRepository(
         self.tmpdir.name,
         url=
         'https://github.com/st-tu-dresden/inloop-java-repository-example.git',
         branch='main')
Beispiel #4
0
 def setUp(self):
     self.tmpdir = TemporaryDirectory()
     self.repo1 = GitRepository(
         self.tmpdir.name,
         url="https://github.com/st-tu-dresden/inloop.git",
         branch="master"
     )
     self.repo2 = GitRepository(
         self.tmpdir.name,
         url="https://github.com/st-tu-dresden/inloop-java-repository-example.git",
         branch="master"
     )
Beispiel #5
0
 def test_empty_branch_raises_valueerror(self):
     with self.assertRaisesRegex(ValueError, 'branch must not be empty'):
         GitRepository(TESTREPO_PATH, url='file:///path/to/repo', branch='')
Beispiel #6
0
 def test_empty_url_raises_valueerror(self):
     with self.assertRaisesRegex(ValueError, 'url must not be empty'):
         GitRepository(TESTREPO_PATH, url='', branch='master')
Beispiel #7
0
def load_tasks_async():
    with HUEY.lock_task("import-lock"):
        load_tasks(
            GitRepository(settings.REPOSITORY_ROOT,
                          url=config.GITLOAD_URL,
                          branch=config.GITLOAD_BRANCH))