def test_get_credential(self):
     with TempDir() as tmp:
         repo = Repo.init_bare(path(tmp) / 'repo.git')
         repo.git.config('github.user', 'damien')
         repo.git.config('github.token', 'xyz')
         c = Credentials.get_credentials(repo)
         eq_('damien', c.user)
         eq_('xyz', c.token)
Exemple #2
0
 def test_get_credential(self):
     with TempDir() as tmp:
         repo = Repo.init_bare(path(tmp) / 'repo.git')
         repo.git.config('github.user', 'damien')
         repo.git.config('github.token', 'xyz')
         c = Credentials.get_credentials(repo)
         eq_('damien', c.user)
         eq_('xyz', c.token)
Exemple #3
0
    def test_init(self):
        with TempDir() as tmp:
            remote_path = tmp / 'remote-repo'
            remote_repo = Repo.create(remote_path, mk_dir=True)
            with open(remote_path / 'test.txt', 'w') as f:
                f.write('testing...')
            remote_repo.git.add('test.txt')
            remote_repo.git.commit('-m', 'testing...')

            # set a local repository and add the module
            local_path = tmp / 'local-repo'
            local_repo = Repo.create(local_path, mk_dir=True)
            module = Submodule(local_repo, 'file://%s' % remote_path, 'test')
            module.init('testing')
            ok_(os.path.exists(local_path / 'test/.git'))
            ok_(os.path.exists(local_path / 'test/test.txt'))
            ok_(os.path.exists(local_path / '.gitmodules'))
 def test_init(self):
     with TempDir() as tmp:
         remote_path = tmp / 'remote-repo'
         remote_repo = Repo.create(remote_path, mk_dir=True)
         with open(remote_path / 'test.txt', 'w') as f:
             f.write('testing...')
         remote_repo.git.add('test.txt')
         remote_repo.git.commit('-m', 'testing...')
         
         # set a local repository and add the module
         local_path = tmp / 'local-repo'
         local_repo = Repo.create(local_path, mk_dir=True)
         module = Submodule(local_repo,
             'file://%s' % remote_path, 'test')
         module.init('testing')
         ok_(os.path.exists(local_path / 'test/.git'))
         ok_(os.path.exists(local_path / 'test/test.txt'))
         ok_(os.path.exists(local_path / '.gitmodules'))
 def test_add(self):
     with TempDir() as tmp:
         # set a remote repository
         remote_path = tmp / 'remote-repo'
         remote_repo = Repo.create(remote_path, mk_dir=True)
         with open(remote_path / 'test.txt', 'w') as f:
             f.write('testing...')
         remote_repo.git.add('test.txt')
         remote_repo.git.commit('-m', 'testing...')
         
         # set a local repository and add the module
         local_path = tmp / 'local-repo'
         local_repo = Repo.create(local_path, mk_dir=True)
         eq_(0, len(local_repo.submodules))
         local_repo.submodules.add('file://%s' % remote_path, 'test')
         ok_(os.path.exists(local_path / 'test/.git'))
         ok_(os.path.exists(local_path / 'test/test.txt'))
         ok_(os.path.exists(local_path / '.gitmodules'))
         eq_(1, len(local_repo.submodules))
         eq_('file://%s' % remote_path, local_repo.submodules['test'].url)
Exemple #6
0
    def test_add(self):
        with TempDir() as tmp:
            # set a remote repository
            remote_path = tmp / 'remote-repo'
            remote_repo = Repo.create(remote_path, mk_dir=True)
            with open(remote_path / 'test.txt', 'w') as f:
                f.write('testing...')
            remote_repo.git.add('test.txt')
            remote_repo.git.commit('-m', 'testing...')

            # set a local repository and add the module
            local_path = tmp / 'local-repo'
            local_repo = Repo.create(local_path, mk_dir=True)
            eq_(0, len(local_repo.submodules))
            local_repo.submodules.add('file://%s' % remote_path, 'test')
            ok_(os.path.exists(local_path / 'test/.git'))
            ok_(os.path.exists(local_path / 'test/test.txt'))
            ok_(os.path.exists(local_path / '.gitmodules'))
            eq_(1, len(local_repo.submodules))
            eq_('file://%s' % remote_path, local_repo.submodules['test'].url)
 def test_new(self):
     with TempDir() as tmp: 
         local_path = tmp / 'local-repo'
         local_repo  = Repo.create(local_path, mk_dir=True)
         module = Submodule(
             local_repo,
             'file://%s' % local_path,
             'test', sha='a'*40, status=' ')
         eq_('file://%s' % local_path, module.url)
         eq_('test', module.path)
         eq_('a'*40, module.sha)
         eq_(' ', module.status)
Exemple #8
0
 def test_new(self):
     with TempDir() as tmp:
         local_path = tmp / 'local-repo'
         local_repo = Repo.create(local_path, mk_dir=True)
         module = Submodule(local_repo,
                            'file://%s' % local_path,
                            'test',
                            sha='a' * 40,
                            status=' ')
         eq_('file://%s' % local_path, module.url)
         eq_('test', module.path)
         eq_('a' * 40, module.sha)
         eq_(' ', module.status)