xBuddy called with a path.
Instead of taking "path" as a kwarg, let it be a continuation of the
call. return_dir is left as an optional arg.
BUG=chromium:254190
TEST=Manual
Run a devserver and query it.
http://{your_ip}:8080/xbuddy/parrot-release/R27-3912.92.0/test
http://{your_ip}:8080/xbuddy/parrot-release/R27-3912.92.0/test?return_dir=t
Change-Id: Id0c1c14d1d2bfd57cdbd41f35e45610154cc01ad
Reviewed-on: https://gerrit.chromium.org/gerrit/60777
Commit-Queue: Joy Chen <joychen@chromium.org>
Reviewed-by: Joy Chen <joychen@chromium.org>
Tested-by: Joy Chen <joychen@chromium.org>
diff --git a/xbuddy_unittest.py b/xbuddy_unittest.py
index 0e07149..bcea713 100644
--- a/xbuddy_unittest.py
+++ b/xbuddy_unittest.py
@@ -44,18 +44,27 @@
def testBasicInterpretPath(self):
"""Basic checks for splitting a path"""
- path = "parrot-release/R27-2455.0.0/test"
+ path = ('parrot-release', 'R27-2455.0.0', 'test')
expected = ('parrot-release', 'R27-2455.0.0', 'test')
- self.assertEqual(self.mock_xb._InterpretPath(path=path), expected)
+ self.assertEqual(self.mock_xb._InterpretPath(path_parts=path), expected)
- path = "parrot-release/R27-2455.0.0/full_payload"
+ path = ('parrot-release', 'R27-2455.0.0', 'full_payload')
expected = ('parrot-release', 'R27-2455.0.0', 'full_payload')
- self.assertEqual(self.mock_xb._InterpretPath(path=path), expected)
+ self.assertEqual(self.mock_xb._InterpretPath(path_parts=path), expected)
- path = "parrot-release/R27-2455.0.0/bad_alias"
+ path = ('parrot-release', 'R27-2455.0.0')
+ expected = ('parrot-release', 'R27-2455.0.0', 'test')
+ self.assertEqual(self.mock_xb._InterpretPath(path_parts=path), expected)
+
+ path = ('parrot-release', 'R27-2455.0.0', 'bad_alias')
self.assertRaises(xbuddy.XBuddyException,
self.mock_xb._InterpretPath,
- path=path)
+ path_parts=path)
+
+ path = ('parrot-release', 'R27-2455.0.0', 'too', 'many', 'pieces')
+ self.assertRaises(xbuddy.XBuddyException,
+ self.mock_xb._InterpretPath,
+ path_parts=path)
def testUnpackArgsWithVersionAliases(self):
# TODO (joyc)
@@ -91,12 +100,12 @@
def testXBuddyCaching(self):
"""Caching & replacement of timestamp files."""
- path_a = "a/latest-local/test"
- path_b = "b/latest-local/test"
- path_c = "c/latest-local/test"
- path_d = "d/latest-local/test"
- path_e = "e/latest-local/test"
- path_f = "f/latest-local/test"
+ path_a = ('a', 'latest-local', 'test')
+ path_b = ('b', 'latest-local', 'test')
+ path_c = ('c', 'latest-local', 'test')
+ path_d = ('d', 'latest-local', 'test')
+ path_e = ('e', 'latest-local', 'test')
+ path_f = ('f', 'latest-local', 'test')
self.mox.StubOutWithMock(self.mock_xb, '_ResolveVersion')
self.mox.StubOutWithMock(self.mock_xb, '_Download')