Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2013-09-01 13:48:23 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2013-09-01 13:48:23 (GMT)
commitf63baafe795c24115fd9ed74e0b48470064e708d (patch)
tree8ff5cc3c20a4b5c7ccc8b6ea4d59544580439236
parent3f0c42ed41529c8d25c217ebc9dc837db39981bf (diff)
Make solutions cache paths shorter
-rw-r--r--sugar_network/client/implementations.py2
-rwxr-xr-xtests/units/client/cache.py2
-rwxr-xr-xtests/units/client/implementations.py8
-rwxr-xr-xtests/units/client/offline_routes.py6
-rwxr-xr-xtests/units/client/online_routes.py30
5 files changed, 24 insertions, 24 deletions
diff --git a/sugar_network/client/implementations.py b/sugar_network/client/implementations.py
index 4a7ba3e..4413c42 100644
--- a/sugar_network/client/implementations.py
+++ b/sugar_network/client/implementations.py
@@ -220,7 +220,7 @@ class Routes(object):
request.session['stability'], request.session['solution'])
def _cache_solution_path(self, guid):
- return client.path('cache', 'solutions', guid[:2], guid)
+ return client.path('solutions', guid[:2], guid)
def _cache_solution_get(self, guid, stability):
path = self._cache_solution_path(guid)
diff --git a/tests/units/client/cache.py b/tests/units/client/cache.py
index 5ae418e..871e62c 100755
--- a/tests/units/client/cache.py
+++ b/tests/units/client/cache.py
@@ -276,7 +276,7 @@ class CacheTest(tests.Test):
'stability = stable',
]])), cmd='submit', initial=True)
- shutil.rmtree('cache')
+ shutil.rmtree('solutions')
conn.put(['context', 'context'], True, cmd='clone')
self.assertEqual([impl1], [i for i in self.client_routes._cache])
assert local_volume['implementation'].exists(impl1)
diff --git a/tests/units/client/implementations.py b/tests/units/client/implementations.py
index dc05d36..08b2f84 100755
--- a/tests/units/client/implementations.py
+++ b/tests/units/client/implementations.py
@@ -154,7 +154,7 @@ class Implementations(tests.Test):
'path': tests.tmpdir + '/client/implementation/%s/%s/data.blob' % (impl[:2], impl),
'guid': impl,
}]]
- cached_path = 'cache/solutions/bu/bundle_id'
+ cached_path = 'solutions/bu/bundle_id'
self.assertEqual('exit', [i for i in conn.get(['context', 'bundle_id'], cmd='launch')][-1]['event'])
self.assertEqual(solution, json.load(file(cached_path)))
@@ -184,7 +184,7 @@ class Implementations(tests.Test):
'path': tests.tmpdir,
'guid': 'impl',
}]])
- cached_path = 'cache/solutions/bu/bundle_id'
+ cached_path = 'solutions/bu/bundle_id'
self.touch([cached_path, solution])
cached_mtime = int(os.stat(cached_path).st_mtime)
@@ -247,7 +247,7 @@ class Implementations(tests.Test):
'path': tests.tmpdir,
'guid': 'impl',
}]])
- self.touch(['cache/solutions/bu/bundle_id', solution])
+ self.touch(['solutions/bu/bundle_id', solution])
client.api_url.value = 'fake'
self.assertEqual('NotFound', [i for i in conn.get(['context', 'bundle_id'], cmd='launch')][-1]['exception'])
@@ -290,7 +290,7 @@ class Implementations(tests.Test):
'license = Public Domain',
'stability = buggy',
]])), cmd='submit')
- cached_path = 'cache/solutions/bu/bundle_id'
+ cached_path = 'solutions/bu/bundle_id'
self.assertEqual('exit', [i for i in conn.get(['context', 'bundle_id'], cmd='launch')][-1]['event'])
self.assertEqual('1', json.load(file(cached_path))[2][0]['version'])
diff --git a/tests/units/client/offline_routes.py b/tests/units/client/offline_routes.py
index 19b8e31..2187c1f 100755
--- a/tests/units/client/offline_routes.py
+++ b/tests/units/client/offline_routes.py
@@ -294,7 +294,7 @@ class OfflineRoutes(tests.Test):
assert local['implementation'].exists(impl)
self.assertEqual(
[client.api_url.value, ['stable'], solution],
- json.load(file('cache/solutions/bu/bundle_id')))
+ json.load(file('solutions/bu/bundle_id')))
self.node.stop()
coroutine.sleep(.1)
@@ -309,7 +309,7 @@ class OfflineRoutes(tests.Test):
assert local['implementation'].exists(impl)
self.assertEqual(
[client.api_url.value, ['stable'], solution],
- json.load(file('cache/solutions/bu/bundle_id')))
+ json.load(file('solutions/bu/bundle_id')))
def test_ServiceUnavailableWhileSolving(self):
ipc = self.start_offline_client()
@@ -369,7 +369,7 @@ Can't find all required implementations:
No known implementations at all""" % (context, impl)},
],
[i for i in ipc.get(['context', context], cmd='launch')])
- assert not exists('cache/solutions/%s/%s' % (context[:2], context))
+ assert not exists('solutions/%s/%s' % (context[:2], context))
def test_ServiceUnavailableWhileInstalling(self):
ipc = self.start_offline_client()
diff --git a/tests/units/client/online_routes.py b/tests/units/client/online_routes.py
index 4d1d4db..391e676 100755
--- a/tests/units/client/online_routes.py
+++ b/tests/units/client/online_routes.py
@@ -394,7 +394,7 @@ Can't find all required implementations:
],
[i for i in conn.put(['context', context], True, cmd='clone')])
- assert not exists('cache/solutions/%s/%s' % (context[:2], context))
+ assert not exists('solutions/%s/%s' % (context[:2], context))
impl = conn.post(['implementation'], {
'context': context,
@@ -434,7 +434,7 @@ Can't find all required implementations:
},
],
[i for i in conn.put(['context', context], True, cmd='clone')])
- assert not exists('cache/solutions/%s/%s' % (context[:2], context))
+ assert not exists('solutions/%s/%s' % (context[:2], context))
def test_clone_Content(self):
local = self.start_online_client([User, Context, Implementation])
@@ -514,7 +514,7 @@ Can't find all required implementations:
local['implementation'].get(impl).meta('data'))
self.assertEqual('content', file(blob_path).read())
assert exists(clone_path + '/data.blob')
- assert not exists('cache/solutions/%s/%s' % (context[:2], context))
+ assert not exists('solutions/%s/%s' % (context[:2], context))
self.assertEqual([
],
@@ -549,7 +549,7 @@ Can't find all required implementations:
local['implementation'].get(impl).meta('data'))
self.assertEqual('content', file(blob_path).read())
assert not lexists(clone_path)
- assert not exists('cache/solutions/%s/%s' % (context[:2], context))
+ assert not exists('solutions/%s/%s' % (context[:2], context))
self.assertEqual([
{'event': 'ready'},
@@ -566,7 +566,7 @@ Can't find all required implementations:
sorted([{'guid': context, 'layer': ['clone']}]),
sorted(ipc.get(['context'], reply='layer')['result']))
assert exists(clone_path + '/data.blob')
- assert not exists('cache/solutions/%s/%s' % (context[:2], context))
+ assert not exists('solutions/%s/%s' % (context[:2], context))
def test_clone_Activity(self):
local = self.start_online_client([User, Context, Implementation])
@@ -658,7 +658,7 @@ Can't find all required implementations:
assert exists(clone_path + '/data.blob/activity/activity.info')
self.assertEqual(
[client.api_url.value, ['stable'], downloaded_solution],
- json.load(file('cache/solutions/bu/bundle_id')))
+ json.load(file('solutions/bu/bundle_id')))
self.assertEqual([
],
@@ -701,7 +701,7 @@ Can't find all required implementations:
assert not exists(clone_path)
self.assertEqual(
[client.api_url.value, ['stable'], downloaded_solution],
- json.load(file('cache/solutions/bu/bundle_id')))
+ json.load(file('solutions/bu/bundle_id')))
self.assertEqual([
{'event': 'ready'},
@@ -720,7 +720,7 @@ Can't find all required implementations:
assert exists(clone_path + '/data.blob/activity/activity.info')
self.assertEqual(
[client.api_url.value, ['stable'], downloaded_solution],
- json.load(file('cache/solutions/bu/bundle_id')))
+ json.load(file('solutions/bu/bundle_id')))
def test_clone_ActivityWithStabilityPreferences(self):
local = self.start_online_client([User, Context, Implementation])
@@ -871,7 +871,7 @@ Can't find all required implementations:
assert local['implementation'].exists(impl)
self.assertEqual(
[client.api_url.value, ['stable'], downloaded_solution],
- json.load(file('cache/solutions/bu/bundle_id')))
+ json.load(file('solutions/bu/bundle_id')))
blob = self.zips(['TestActivity/activity/activity.info', [
'[Activity]',
@@ -885,7 +885,7 @@ Can't find all required implementations:
impl = ipc.upload(['implementation'], StringIO(blob), cmd='submit')
coroutine.sleep(.1)
- shutil.rmtree('cache/solutions')
+ shutil.rmtree('solutions')
solution = [{
'guid': impl,
'context': 'bundle_id',
@@ -905,7 +905,7 @@ Can't find all required implementations:
assert local['implementation'].exists(impl)
self.assertEqual(
[client.api_url.value, ['stable'], solution],
- json.load(file('cache/solutions/bu/bundle_id')))
+ json.load(file('solutions/bu/bundle_id')))
self.node.stop()
coroutine.sleep(.1)
@@ -920,9 +920,9 @@ Can't find all required implementations:
assert local['implementation'].exists(impl)
self.assertEqual(
[client.api_url.value, ['stable'], solution],
- json.load(file('cache/solutions/bu/bundle_id')))
+ json.load(file('solutions/bu/bundle_id')))
- shutil.rmtree('cache/solutions')
+ shutil.rmtree('solutions')
log_path = tests.tmpdir + '/.sugar/default/logs/bundle_id_3.log'
self.assertEqual([
{'event': 'launch', 'foo': 'bar', 'activity_id': 'activity_id'},
@@ -933,7 +933,7 @@ Can't find all required implementations:
assert local['implementation'].exists(impl)
self.assertEqual(
[client.api_url.value, ['stable'], solution],
- json.load(file('cache/solutions/bu/bundle_id')))
+ json.load(file('solutions/bu/bundle_id')))
def test_launch_Fails(self):
local = self.start_online_client([User, Context, Implementation])
@@ -1004,7 +1004,7 @@ Can't find all required implementations:
assert local['implementation'].exists(impl)
self.assertEqual(
[client.api_url.value, ['stable'], solution],
- json.load(file('cache/solutions/bu/bundle_id')))
+ json.load(file('solutions/bu/bundle_id')))
def test_InvalidateSolutions(self):
self.start_online_client()