Пример #1
0
 def test_checkout_failing_non_interactive(self, setup):
     auth = SvnAuth('johnny', 'bar', cache_auth=False,
                            interactive=False)
     wc = py.path.svnwc(setup.temppath, auth)
     py.test.raises(Exception,
        ("wc.checkout('svn://localhost:%(port)s/%(repopath)s')" %
          setup.__dict__))
Пример #2
0
    def test_listdir(self, setup):
        port = setup.port
        u = py.path.svnurl(
            'svn://localhost:%s/%s' % (port, setup.repopath.basename),
            auth=setup.auth)
        u.ensure('foo')
        paths = u.listdir()
        assert len(paths) == 1
        assert paths[0].auth is setup.auth

        auth = SvnAuth('foo', 'bar', interactive=False)
        u = py.path.svnurl(
            'svn://localhost:%s/%s' % (port, setup.repopath.basename),
            auth=auth)
        py.test.raises(Exception, 'u.listdir()')
Пример #3
0
    def test_update(self, setup):
        wc1 = py.path.svnwc(setup.temppath.ensure('wc1', dir=True),
                            auth=setup.auth)
        wc2 = py.path.svnwc(setup.temppath.ensure('wc2', dir=True),
                            auth=setup.auth)
        wc1.checkout(
            'svn://localhost:%s/%s' % (setup.port, setup.repopath.basename))
        wc2.checkout(
            'svn://localhost:%s/%s' % (setup.port, setup.repopath.basename))
        wc1.ensure('foo', dir=True)
        wc1.commit('added foo dir')
        wc2.update()
        assert wc2.join('foo').check()

        auth = SvnAuth('unknown', 'unknown', interactive=False)
        wc2.auth = auth
        py.test.raises(Exception, 'wc2.update()')
Пример #4
0
    def test_copy(self):
        port = self.port
        u = py.path.svnurl('svn://localhost:%s/%s' %
                           (port, self.repopath.basename),
                           auth=self.auth)
        foo = u.ensure('foo')
        bar = u.join('bar')
        foo.copy(bar)
        assert bar.check()
        assert bar.auth is self.auth

        auth = SvnAuth('foo', 'bar', interactive=False)
        u = py.path.svnurl('svn://localhost:%s/%s' %
                           (port, self.repopath.basename),
                           auth=auth)
        foo = u.join('foo')
        bar = u.join('bar')
        py.test.raises(Exception, 'foo.copy(bar)')
Пример #5
0
    def test_write_read(self, setup):
        port = setup.port
        u = py.path.svnurl(
            'svn://localhost:%s/%s' % (port, setup.repopath.basename),
            auth=setup.auth)
        foo = u.ensure('foo')
        fp = foo.open()
        try:
            data = fp.read()
        finally:
            fp.close()
        assert data == ''

        auth = SvnAuth('foo', 'bar', interactive=False)
        u = py.path.svnurl(
            'svn://localhost:%s/%s' % (port, setup.repopath.basename),
            auth=auth)
        foo = u.join('foo')
        py.test.raises(Exception, 'foo.open()')
Пример #6
0
    def test_lock_unlock_status(self, setup):
        port = setup.port
        wc = py.path.svnwc(setup.temppath, auth=setup.auth)
        wc.checkout(
            'svn://localhost:%s/%s' % (port, setup.repopath.basename,))
        wc.ensure('foo', file=True)
        wc.commit('added foo file')
        foo = wc.join('foo')
        foo.lock()
        status = foo.status()
        assert status.locked
        foo.unlock()
        status = foo.status()
        assert not status.locked

        auth = SvnAuth('unknown', 'unknown', interactive=False)
        foo.auth = auth
        py.test.raises(Exception, 'foo.lock()')
        py.test.raises(Exception, 'foo.unlock()')
Пример #7
0
    def test_diff(self, setup):
        port = setup.port
        wc = py.path.svnwc(setup.temppath, auth=setup.auth)
        wc.checkout(
            'svn://localhost:%s/%s' % (port, setup.repopath.basename,))
        wc.ensure('foo', file=True)
        wc.commit('added foo file')
        wc.update()
        rev = int(wc.status().rev)
        foo = wc.join('foo')
        foo.write('bar')
        diff = foo.diff()
        assert '\n+bar\n' in diff
        foo.commit('added some content')
        diff = foo.diff()
        assert not diff
        diff = foo.diff(rev=rev)
        assert '\n+bar\n' in diff

        auth = SvnAuth('unknown', 'unknown', interactive=False)
        foo.auth = auth
        py.test.raises(Exception, 'foo.diff(rev=rev)')
Пример #8
0
    def __init__(self, request):
        if not svnbin:
            py.test.skip("svn binary required")
        if not request.config.option.runslowtests:
            py.test.skip('use --runslowtests to run these tests')

        tmpdir = request.getfuncargvalue("tmpdir")
        repodir = tmpdir.join("repo")
        py.process.cmdexec('svnadmin create %s' % repodir)
        if sys.platform == 'win32':
            repodir = '/' + str(repodir).replace('\\', '/')
        self.repo = py.path.svnurl("file://%s" % repodir)
        if py.std.sys.platform == 'win32':
            # remove trailing slash...
            repodir = repodir[1:]
        self.repopath = py.path.local(repodir)
        self.temppath = tmpdir.mkdir("temppath")
        self.auth = SvnAuth('johnny', 'foo', cache_auth=False,
                                    interactive=False)
        make_repo_auth(self.repopath, {'johnny': ('foo', 'rw')})
        self.port, self.pid = serve_bg(self.repopath.dirpath())
        # XXX caching is too global
        py.path.svnurl._lsnorevcache._dict.clear()
        request.addfinalizer(lambda: py.process.kill(self.pid))
Пример #9
0
 def test_makecmdoptions_no_interactive_no_cache_auth(self):
     auth = SvnAuth('foo', 'bar', cache_auth=False,
                            interactive=False)
     assert auth.makecmdoptions() == ('--username="******" --password="******" '
                                      '--no-auth-cache --non-interactive')
Пример #10
0
 def test_makecmdoptions_quote_escape(self):
     auth = SvnAuth('fo"o', '"ba\'r"')
     assert auth.makecmdoptions() == '--username="******"o" --password="******"ba\'r\\""'
Пример #11
0
 def test_makecmdoptions_uname_pw_makestr(self):
     auth = SvnAuth('foo', 'bar')
     assert auth.makecmdoptions() == '--username="******" --password="******"'
Пример #12
0
 def test_basic(self):
     auth = SvnAuth('foo', 'bar')
     assert auth.username == 'foo'
     assert auth.password == 'bar'
     assert str(auth)
Пример #13
0
 def setup_method(self, meth):
     self.auth = SvnAuth('foo', 'bar')
Пример #14
0
 def setup_method(self, meth):
     if not svnbin:
         py.test.skip("svn binary required")
     self.auth = SvnAuth('user', 'pass', cache_auth=False)
Пример #15
0
 def setup_method(self, meth):
     svnurl_no_svn.commands = []
     self.auth = SvnAuth('foo', 'bar')
Пример #16
0
 def setup_method(self, meth):
     self.auth = SvnAuth('user', 'pass', cache_auth=False)
     svntestbase.getsvnbin()