~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/bindings/swig/python/tests/ra.py

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
298
298
    ra.get_file_revs(self.ra_ctx, "trunk/README.txt", 0, 10, rev_handler)
299
299
 
300
300
  def test_lock(self):
301
 
    def callback(baton, path, do_lock, lock, ra_err, pool):
302
 
      pass
303
 
    # This test merely makes sure that the arguments can be wrapped
304
 
    # properly. svn.ra.lock() currently fails because it is not possible
305
 
    # to retrieve the username from the auth_baton yet.
306
 
    self.assertRaises(core.SubversionException,
307
 
      lambda: ra.lock(self.ra_ctx, {"": 0}, "sleutel", False, callback))
 
301
 
 
302
    self.calls = 0
 
303
    self.locks = 0
 
304
    self.errors = 0
 
305
    def callback(path, do_lock, lock, ra_err, pool):
 
306
      self.calls += 1
 
307
      self.assertEqual(path, "trunk/README2.txt")
 
308
      if lock:
 
309
        self.assertEqual(lock.owner, "jrandom")
 
310
        self.locks += 1
 
311
      if ra_err:
 
312
        self.assert_(ra_err.apr_err == core.SVN_ERR_FS_PATH_ALREADY_LOCKED
 
313
                     or ra_err.apr_err == core.SVN_ERR_FS_NO_SUCH_LOCK)
 
314
        self.errors += 1
 
315
 
 
316
    providers = [core.svn_auth_get_username_provider()]
 
317
    self.callbacks.auth_baton = core.svn_auth_open(providers)
 
318
    core.svn_auth_set_parameter(self.callbacks.auth_baton,
 
319
                                core.SVN_AUTH_PARAM_DEFAULT_USERNAME,
 
320
                                "jrandom")
 
321
    self.ra_ctx = ra.open2(self.repos_uri, self.callbacks, {})
 
322
    rev = fs.youngest_rev(self.fs)
 
323
    ra.lock(self.ra_ctx, {"trunk/README2.txt":rev}, "sleutel", False, callback)
 
324
    self.assertEqual(self.calls, 1)
 
325
    self.assertEqual(self.locks, 1)
 
326
    self.assertEqual(self.errors, 0)
 
327
 
 
328
    self.calls = 0
 
329
    self.locks = 0
 
330
    ra.lock(self.ra_ctx, {"trunk/README2.txt":rev}, "sleutel", False, callback)
 
331
    self.assertEqual(self.calls, 1)
 
332
    self.assertEqual(self.locks, 0)
 
333
    self.assertEqual(self.errors, 1)
 
334
 
 
335
    self.calls = 0
 
336
    self.errors = 0
 
337
    the_lock = fs.get_lock(self.fs, "/trunk/README2.txt")
 
338
    ra.unlock(self.ra_ctx, {"trunk/README2.txt":the_lock.token}, False, callback)
 
339
    self.assertEqual(self.calls, 1)
 
340
    self.assertEqual(self.locks, 0)
 
341
    self.assertEqual(self.errors, 0)
 
342
 
 
343
    self.calls = 0
 
344
    ra.unlock(self.ra_ctx, {"trunk/README2.txt":the_lock.token}, False, callback)
 
345
    self.assertEqual(self.calls, 1)
 
346
    self.assertEqual(self.locks, 0)
 
347
    self.assertEqual(self.errors, 1)
308
348
 
309
349
  def test_get_log2(self):
310
350
    # Get an interesting commmit.