Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/bindings/swig/python/tests/client.py view on Meta::CPAN
end = core.svn_opt_revision_t()
end.kind = core.svn_opt_revision_number
end.value.number = 9
rrange = core.svn_opt_revision_range_t()
rrange.start = start
rrange.end = end
client.merge_peg3(v1x_path, (rrange,), end, trunk_path,
core.svn_depth_infinity, False, False, False, False,
None, self.client_ctx)
# Did it take effect?
readme_path_native = core.svn_dirent_local_style(
core.svn_dirent_join(trunk_path, 'README.txt')
)
readme = open(readme_path_native, 'r')
readme_text = readme.read()
readme.close()
self.assertEqual(readme_text, 'This is a test.\n')
def test_platform_providers(self):
providers = core.svn_auth_get_platform_specific_client_providers(None, None)
# Not much more we can test in this minimal environment.
self.assert_(isinstance(providers, list))
self.assert_(not filter(lambda x:
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,
( run in 0.331 second using v1.01-cache-2.11-cpan-71847e10f99 )