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)
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)
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 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 test_empty_branch_raises_valueerror(self): with self.assertRaisesRegex(ValueError, 'branch must not be empty'): GitRepository(TESTREPO_PATH, url='file:///path/to/repo', branch='')
def test_empty_url_raises_valueerror(self): with self.assertRaisesRegex(ValueError, 'url must not be empty'): GitRepository(TESTREPO_PATH, url='', branch='master')
def load_tasks_async(): with HUEY.lock_task("import-lock"): load_tasks( GitRepository(settings.REPOSITORY_ROOT, url=config.GITLOAD_URL, branch=config.GITLOAD_BRANCH))