Rev 427: Find a case that isn't handled easily, punt. in http://bazaar.launchpad.net/~jameinel/loggerhead/less_work_for_head_716217
John Arbash Meinel
john at arbash-meinel.com
Thu Feb 10 05:15:38 UTC 2011
At http://bazaar.launchpad.net/~jameinel/loggerhead/less_work_for_head_716217
------------------------------------------------------------
revno: 427
revision-id: john at arbash-meinel.com-20110210051536-cb0gos23mrruty8e
parent: john at arbash-meinel.com-20110210050839-otj1scbvy5b6n97l
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: less_work_for_head_716217
timestamp: Wed 2011-02-09 23:15:36 -0600
message:
Find a case that isn't handled easily, punt.
Note that the tests assert what error is raised, but we really want a better one.
Not worth fixing until we get more of old trunk/experimental merged.
-------------- next part --------------
=== modified file 'loggerhead/controllers/changelog_ui.py'
--- a/loggerhead/controllers/changelog_ui.py 2011-02-10 05:08:39 +0000
+++ b/loggerhead/controllers/changelog_ui.py 2011-02-10 05:15:36 +0000
@@ -36,13 +36,14 @@
template_path = 'loggerhead.templates.changelog'
def validate_call(self, path, kwargs, headers):
- if path is not None or kwargs:
+ if path is not None or kwargs or self.args:
# This includes a file-id, abort for now
return False
# Make sure we have a valid revid
+ # XXX: If revid is a string and not in the history of the branch, we
+ # won't detect that here. That is done as part of get_view. For
+ # now, if self.args is not empty, we just abort above.
self.get_revid()
- # XXX: If revid is a string and not in the history of the branch, we
- # won't detect that here. That is done as part of get_view.
# Note: We know it is safe to return True, because we don't set any
# actual headers. As long as path is None and there aren't
# kwargs, then the only remaining bit is if revid is not actually
=== modified file 'loggerhead/tests/test_controllers.py'
--- a/loggerhead/tests/test_controllers.py 2011-02-10 05:05:43 +0000
+++ b/loggerhead/tests/test_controllers.py 2011-02-10 05:15:36 +0000
@@ -1,4 +1,7 @@
from cStringIO import StringIO
+import logging
+
+from paste.httpexceptions import HTTPServerError
from bzrlib import errors
@@ -21,6 +24,7 @@
tree.branch.lock_read()
self.addCleanup(tree.branch.unlock)
branch_app = BranchWSGIApp(tree.branch, '')
+ branch_app.log.setLevel(logging.CRITICAL)
# These are usually set in BranchWSGIApp.app(), which is set from env
# settings set by BranchesFromTransportRoot, so we fake it.
branch_app._static_url_base = '/'
@@ -57,13 +61,24 @@
start)
self.assertEqualDiff('', content)
- def test_simple_head_bad_revid(self):
+ def test_simple_head_bad_revno(self):
bzrbranch, change_ui = self.make_branch_and_changelog_ui(
['file'])
+ # TODO: This is not the ideal error. should be 404, to be done in a
+ # future patch
self.assertRaises(errors.NoSuchRevision, self.consume_app,
change_ui, extra_environ={'REQUEST_METHOD': 'HEAD',
'PATH_INFO': '/9999'})
+ def test_simple_head_bad_revid(self):
+ bzrbranch, change_ui = self.make_branch_and_changelog_ui(
+ ['file'])
+ # TODO: This is not the ideal error. should probably be 404, to be done
+ # in a future patch
+ self.assertRaises(HTTPServerError, self.consume_app,
+ change_ui, extra_environ={'REQUEST_METHOD': 'HEAD',
+ 'PATH_INFO': '/no-such-revid'})
+
class TestInventoryUI(BasicTests):
More information about the bazaar-commits
mailing list