Rev 1265: Merge tests for ra.so. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4

Jelmer Vernooij jelmer at samba.org
Sun Jun 22 09:31:14 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/0.4

------------------------------------------------------------
revno: 1265
revision-id: jelmer at samba.org-20080622083112-68pzny4uxj2ttk3a
parent: jelmer at samba.org-20080622081715-rphnf9fi49covcz1
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sun 2008-06-22 10:31:12 +0200
message:
  Merge tests for ra.so.
added:
  tests/test_ra.py               test_ra.py-20080313141743-uzsm7ejitrlqone5-1
modified:
  errors.py                      errors.py-20061226172623-w1sbj8ynpo0eojqp-1
  tests/__init__.py              __init__.py-20060508151940-e9f4d914801a2535
=== modified file 'errors.py'
--- a/errors.py	2008-06-21 16:21:46 +0000
+++ b/errors.py	2008-06-22 08:31:12 +0000
@@ -54,6 +54,7 @@
 ERR_WC_PATH_NOT_FOUND = 155010
 ERR_CANCELLED = 200015
 ERR_WC_UNSUPPORTED_FORMAT = 155021
+ERR_UNKNOWN_CAPABILITY = 200026
 
 
 class NotSvnBranchPath(NotBranchError):

=== modified file 'tests/__init__.py'
--- a/tests/__init__.py	2008-06-22 08:17:15 +0000
+++ b/tests/__init__.py	2008-06-22 08:31:12 +0000
@@ -381,6 +381,7 @@
             'test_logwalker',
             'test_mapping',
             'test_push',
+            'test_ra',
             'test_radir',
             'test_repos', 
             'test_repository', 

=== added file 'tests/test_ra.py'
--- a/tests/test_ra.py	1970-01-01 00:00:00 +0000
+++ b/tests/test_ra.py	2008-06-22 08:31:12 +0000
@@ -0,0 +1,115 @@
+# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer at samba.org>
+ 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""Subversion ra library tests."""
+
+from bzrlib.tests import TestCase, TestSkipped
+from bzrlib.plugins.svn import core, ra
+from bzrlib.plugins.svn.tests import TestCaseWithSubversionRepository
+
+class VersionTest(TestCase):
+    def test_version_length(self):
+        self.assertEquals(4, len(ra.version()))
+
+
+class TestRemoteAccess(TestCaseWithSubversionRepository):
+    def setUp(self):
+        super(TestRemoteAccess, self).setUp()
+        self.repos_url = self.make_client("d", "dc")
+        self.ra = ra.RemoteAccess(self.repos_url)
+
+    def do_commit(self):
+        self.build_tree({'dc/foo': None})
+        self.client_add("dc/foo")
+        self.client_commit("dc", "msg")
+
+    def test_repr(self):
+        self.assertEquals("RemoteAccess(%s)" % self.repos_url,
+                          repr(self.ra))
+
+    def test_latest_revnum(self):
+        self.assertEquals(0, self.ra.get_latest_revnum())
+
+    def test_latest_revnum_one(self):
+        self.do_commit()
+        self.assertEquals(1, self.ra.get_latest_revnum())
+
+    def test_get_uuid(self):
+        self.assertIsInstance(self.ra.get_uuid(), str)
+
+    def test_get_repos_root(self):
+        self.assertEqual(self.repos_url, self.ra.get_repos_root())
+
+    def test_reparent(self):
+        self.ra.reparent(self.repos_url)
+
+    def test_has_capability(self):
+        try:
+            self.assertRaises(core.SubversionException, self.ra.has_capability, "FOO")
+        except NotImplementedError:
+            # svn < 1.5
+            raise TestSkipped
+
+    def test_get_dir(self):
+        ret = self.ra.get_dir("", 0)
+        self.assertIsInstance(ret, tuple)
+
+    def test_change_rev_prop(self):
+        self.do_commit()
+        self.ra.change_rev_prop(1, "foo", "bar")
+
+    def test_rev_proplist(self):
+        self.assertIsInstance(self.ra.rev_proplist(0), dict)
+
+    def test_get_log(self):
+        returned = []
+        def cb(*args):
+            returned.append(args)
+        def check_results(returned):
+            self.assertEquals(2, len(returned))
+            (paths, revnum, props) = returned[0]
+            self.assertEquals(None, paths)
+            self.assertEquals(revnum, 0)
+            self.assertEquals(["svn:date"], props.keys())
+            (paths, revnum, props) = returned[1]
+            self.assertEquals({'/foo': ('A', None, -1)}, paths)
+            self.assertEquals(revnum, 1)
+            self.assertEquals(set(["svn:date", "svn:author", "svn:log"]), 
+                              set(props.keys()))
+        self.ra.get_log(cb, [""], 0, 0)
+        self.assertEquals(1, len(returned))
+        self.do_commit()
+        returned = []
+        self.ra.get_log(cb, None, 0, 1, discover_changed_paths=True, 
+                        strict_node_history=False)
+        check_results(returned)
+
+    def test_get_commit_editor_busy(self):
+        def mycb(rev):
+            pass
+        editor = self.ra.get_commit_editor({"svn:log": "foo"}, mycb)
+        self.assertRaises(ra.BusyException, self.ra.get_commit_editor, {"svn:log": "foo"}, mycb)
+        editor.abort()
+
+    def test_get_commit_editor(self):
+        def mycb(paths, rev, revprops):
+            pass
+        editor = self.ra.get_commit_editor({"svn:log": "foo"}, mycb)
+        dir = editor.open_root(0)
+        subdir = dir.add_directory("foo")
+        subdir.close()
+        dir.close()
+        editor.close()
+




More information about the bazaar-commits mailing list