summaryrefslogtreecommitdiff
path: root/subversion/bindings/swig/python/tests/client.py
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/bindings/swig/python/tests/client.py')
-rw-r--r--subversion/bindings/swig/python/tests/client.py118
1 files changed, 118 insertions, 0 deletions
diff --git a/subversion/bindings/swig/python/tests/client.py b/subversion/bindings/swig/python/tests/client.py
index 0905557..07fb773 100644
--- a/subversion/bindings/swig/python/tests/client.py
+++ b/subversion/bindings/swig/python/tests/client.py
@@ -382,6 +382,124 @@ class SubversionClientTestCase(unittest.TestCase):
not isinstance(x, core.svn_auth_provider_object_t),
providers))
+ def testGnomeKeyring(self):
+ if not hasattr(core, 'svn_auth_set_gnome_keyring_unlock_prompt_func'):
+ # gnome-keying not compiled in, do nothing
+ return
+
+ # This tests setting the gnome-keyring unlock prompt function as an
+ # auth baton parameter. It doesn't actually call gnome-keyring
+ # stuff, since that would require having a gnome-keyring running. We
+ # just test if this doesn't error out, there's not even a return
+ # value to test.
+ def prompt_func(realm_string, pool):
+ return "Foo"
+
+ core.svn_auth_set_gnome_keyring_unlock_prompt_func(self.client_ctx.auth_baton, prompt_func)
+
+ def proplist_receiver_trunk(self, path, props, iprops, pool):
+ self.assertEquals(props['svn:global-ignores'], '*.q\n')
+ self.proplist_receiver_trunk_calls += 1
+
+ def proplist_receiver_dir1(self, path, props, iprops, pool):
+ self.assertEquals(iprops[self.proplist_receiver_dir1_key],
+ {'svn:global-ignores':'*.q\n'})
+ self.proplist_receiver_dir1_calls += 1
+
+ def test_inherited_props(self):
+ """Test inherited props"""
+
+ trunk_url = self.repos_uri + '/trunk'
+ client.propset_remote('svn:global-ignores', '*.q', trunk_url,
+ False, 12, {}, None, self.client_ctx)
+
+ head = core.svn_opt_revision_t()
+ head.kind = core.svn_opt_revision_head
+ props, iprops, rev = client.propget5('svn:global-ignores', trunk_url,
+ head, head, core.svn_depth_infinity,
+ None, self.client_ctx)
+ self.assertEquals(props[trunk_url], '*.q\n')
+
+ dir1_url = trunk_url + '/dir1'
+ props, iprops, rev = client.propget5('svn:global-ignores', dir1_url,
+ head, head, core.svn_depth_infinity,
+ None, self.client_ctx)
+ self.assertEquals(iprops[trunk_url], {'svn:global-ignores':'*.q\n'})
+
+ self.proplist_receiver_trunk_calls = 0
+ client.proplist4(trunk_url, head, head, core.svn_depth_empty, None, True,
+ self.proplist_receiver_trunk, self.client_ctx)
+ self.assertEquals(self.proplist_receiver_trunk_calls, 1)
+
+ self.proplist_receiver_dir1_calls = 0
+ self.proplist_receiver_dir1_key = trunk_url
+ client.proplist4(dir1_url, head, head, core.svn_depth_empty, None, True,
+ self.proplist_receiver_dir1, self.client_ctx)
+ self.assertEquals(self.proplist_receiver_dir1_calls, 1)
+
+ def test_update4(self):
+ """Test update and the notify function callbacks"""
+
+ rev = core.svn_opt_revision_t()
+ rev.kind = core.svn_opt_revision_number
+ rev.value.number = 0
+
+ path = self.temper.alloc_empty_dir('-update')
+
+ self.assertRaises(ValueError, client.checkout2,
+ self.repos_uri, path, None, None, True, True,
+ self.client_ctx)
+
+ client.checkout2(self.repos_uri, path, rev, rev, True, True,
+ self.client_ctx)
+
+ def notify_func(path, action, kind, mime_type, content_state, prop_state, rev):
+ self.notified_paths.append(path)
+
+ self.client_ctx.notify_func = client.svn_swig_py_notify_func
+ self.client_ctx.notify_baton = notify_func
+ rev.value.number = 1
+ self.notified_paths = []
+ client.update4((path,), rev, core.svn_depth_unknown, True, False, False,
+ False, False, self.client_ctx)
+ expected_paths = [
+ path,
+ os.path.join(path, 'branches'),
+ os.path.join(path, 'tags'),
+ os.path.join(path, 'trunk'),
+ path,
+ path
+ ]
+ # All normal subversion apis process paths in Subversion's canonical format,
+ # which isn't the platform specific format
+ expected_paths = [x.replace(os.path.sep, '/') for x in expected_paths]
+ self.notified_paths.sort()
+ expected_paths.sort()
+
+ self.assertEquals(self.notified_paths, expected_paths)
+
+ def notify_func2(notify, pool):
+ self.notified_paths.append(notify.path)
+
+ self.client_ctx.notify_func2 = client.svn_swig_py_notify_func2
+ self.client_ctx.notify_baton2 = notify_func2
+ rev.value.number = 2
+ self.notified_paths = []
+ expected_paths = [
+ path,
+ os.path.join(path, 'trunk', 'README.txt'),
+ os.path.join(path, 'trunk'),
+ path,
+ path
+ ]
+ expected_paths = [x.replace(os.path.sep, '/') for x in expected_paths]
+ client.update4((path,), rev, core.svn_depth_unknown, True, False, False,
+ False, False, self.client_ctx)
+ self.notified_paths.sort()
+ expected_paths.sort()
+ self.assertEquals(self.notified_paths, expected_paths)
+
+
def suite():
return unittest.defaultTestLoader.loadTestsFromTestCase(
SubversionClientTestCase)