diff options
Diffstat (limited to 'tests/units/client')
-rw-r--r-- | tests/units/client/__main__.py | 2 | ||||
-rwxr-xr-x | tests/units/client/cache.py | 146 | ||||
-rwxr-xr-x | tests/units/client/offline_routes.py | 38 | ||||
-rwxr-xr-x | tests/units/client/online_routes.py | 164 | ||||
-rwxr-xr-x | tests/units/client/releases.py (renamed from tests/units/client/implementations.py) | 46 | ||||
-rwxr-xr-x | tests/units/client/routes.py | 26 | ||||
-rwxr-xr-x | tests/units/client/solver.py | 22 |
7 files changed, 222 insertions, 222 deletions
diff --git a/tests/units/client/__main__.py b/tests/units/client/__main__.py index f9ed28e..849cf0b 100644 --- a/tests/units/client/__main__.py +++ b/tests/units/client/__main__.py @@ -9,7 +9,7 @@ from offline_routes import * from online_routes import * from server_routes import * from cache import * -from implementations import * +from releases import * if __name__ == '__main__': tests.main() diff --git a/tests/units/client/cache.py b/tests/units/client/cache.py index 6a73f36..e980549 100755 --- a/tests/units/client/cache.py +++ b/tests/units/client/cache.py @@ -12,7 +12,7 @@ from __init__ import tests from sugar_network import db from sugar_network.model.context import Context -from sugar_network.model.implementation import Implementation +from sugar_network.model.release import Release from sugar_network.client import cache_limit, cache_limit_percent, cache_lifetime, IPCConnection from sugar_network.client.cache import Cache from sugar_network.toolkit import http @@ -32,9 +32,9 @@ class CacheTest(tests.Test): self.override(os, 'statvfs', lambda *args: statvfs()) def test_open(self): - volume = db.Volume('db', [Context, Implementation]) + volume = db.Volume('db', [Context, Release]) - volume['implementation'].create({ + volume['release'].create({ 'guid': '1', 'context': 'context', 'license': ['GPL'], @@ -42,8 +42,8 @@ class CacheTest(tests.Test): 'stability': 'stable', 'data': {'blob_size': 1}, }) - os.utime('db/implementation/1/1', (1, 1)) - volume['implementation'].create({ + os.utime('db/release/1/1', (1, 1)) + volume['release'].create({ 'guid': '5', 'context': 'context', 'license': ['GPL'], @@ -51,8 +51,8 @@ class CacheTest(tests.Test): 'stability': 'stable', 'data': {'blob_size': 5}, }) - os.utime('db/implementation/5/5', (5, 5)) - volume['implementation'].create({ + os.utime('db/release/5/5', (5, 5)) + volume['release'].create({ 'guid': '2', 'context': 'context', 'license': ['GPL'], @@ -60,16 +60,16 @@ class CacheTest(tests.Test): 'stability': 'stable', 'data': {}, }) - os.utime('db/implementation/2/2', (2, 2)) - volume['implementation'].create({ + os.utime('db/release/2/2', (2, 2)) + volume['release'].create({ 'guid': '3', 'context': 'context', 'license': ['GPL'], 'version': '3', 'stability': 'stable', }) - os.utime('db/implementation/3/3', (3, 3)) - volume['implementation'].create({ + os.utime('db/release/3/3', (3, 3)) + volume['release'].create({ 'guid': '4', 'context': 'context', 'license': ['GPL'], @@ -77,13 +77,13 @@ class CacheTest(tests.Test): 'stability': 'stable', 'data': {'blob_size': 4, 'unpack_size': 44}, }) - os.utime('db/implementation/4/4', (4, 4)) + os.utime('db/release/4/4', (4, 4)) cache = Cache(volume) self.assertEqual(['5', '4', '1'], [i for i in cache]) def test_open_IgnoreClones(self): - volume = db.Volume('db', [Context, Implementation]) + volume = db.Volume('db', [Context, Release]) volume['context'].create({ 'guid': 'context', @@ -92,7 +92,7 @@ class CacheTest(tests.Test): 'summary': 'summary', 'description': 'description', }) - volume['implementation'].create({ + volume['release'].create({ 'guid': 'impl', 'context': 'context', 'license': ['GPL'], @@ -104,113 +104,113 @@ class CacheTest(tests.Test): cache = Cache(volume) self.assertEqual(['impl'], [i for i in cache]) - os.symlink('../../../implementation/im/impl', 'db/context/co/context/.clone') + os.symlink('../../../release/im/impl', 'db/context/co/context/.clone') cache = Cache(volume) self.assertEqual([], [i for i in cache]) def test_ensure_AfterOpen(self): - volume = db.Volume('db', [Context, Implementation]) - - volume['implementation'].create({'data': {'blob_size': 1}, 'guid': '1', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) - os.utime('db/implementation/1/1', (1, 1)) - volume['implementation'].create({'data': {'blob_size': 2}, 'guid': '2', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) - os.utime('db/implementation/2/2', (2, 2)) - volume['implementation'].create({'data': {'blob_size': 3}, 'guid': '3', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) - os.utime('db/implementation/3/3', (3, 3)) + volume = db.Volume('db', [Context, Release]) + + volume['release'].create({'data': {'blob_size': 1}, 'guid': '1', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + os.utime('db/release/1/1', (1, 1)) + volume['release'].create({'data': {'blob_size': 2}, 'guid': '2', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + os.utime('db/release/2/2', (2, 2)) + volume['release'].create({'data': {'blob_size': 3}, 'guid': '3', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + os.utime('db/release/3/3', (3, 3)) cache = Cache(volume) cache_limit.value = 10 self.statvfs.f_bfree = 11 self.assertRaises(RuntimeError, cache.ensure, 100, 0) - assert volume['implementation'].exists('1') - assert volume['implementation'].exists('2') - assert volume['implementation'].exists('3') + assert volume['release'].exists('1') + assert volume['release'].exists('2') + assert volume['release'].exists('3') cache.ensure(1, 0) - assert volume['implementation'].exists('1') - assert volume['implementation'].exists('2') - assert volume['implementation'].exists('3') + assert volume['release'].exists('1') + assert volume['release'].exists('2') + assert volume['release'].exists('3') cache.ensure(2, 0) - assert not volume['implementation'].exists('1') - assert volume['implementation'].exists('2') - assert volume['implementation'].exists('3') + assert not volume['release'].exists('1') + assert volume['release'].exists('2') + assert volume['release'].exists('3') cache.ensure(4, 0) - assert not volume['implementation'].exists('2') - assert not volume['implementation'].exists('3') + assert not volume['release'].exists('2') + assert not volume['release'].exists('3') self.assertRaises(RuntimeError, cache.ensure, 2, 0) def test_ensure_Live(self): - volume = db.Volume('db', [Context, Implementation]) + volume = db.Volume('db', [Context, Release]) cache = Cache(volume) # To initiate the cache cache.ensure(0, 0) - volume['implementation'].create({'data': {'blob_size': 1}, 'guid': '1', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + volume['release'].create({'data': {'blob_size': 1}, 'guid': '1', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) cache.checkin('1', 1) cache_limit.value = 10 self.statvfs.f_bfree = 10 cache.ensure(1, 0) - assert not volume['implementation'].exists('1') + assert not volume['release'].exists('1') self.assertRaises(RuntimeError, cache.ensure, 1, 0) def test_ensure_ConsiderTmpSize(self): - volume = db.Volume('db', [Context, Implementation]) - volume['implementation'].create({'data': {'blob_size': 1}, 'guid': '1', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + volume = db.Volume('db', [Context, Release]) + volume['release'].create({'data': {'blob_size': 1}, 'guid': '1', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) cache = Cache(volume) cache_limit.value = 10 self.statvfs.f_bfree = 10 self.assertRaises(RuntimeError, cache.ensure, 1, 11) - assert volume['implementation'].exists('1') + assert volume['release'].exists('1') cache.ensure(1, 10) - assert not volume['implementation'].exists('1') + assert not volume['release'].exists('1') def test_recycle(self): ts = time.time() - volume = db.Volume('db', [Context, Implementation]) - volume['implementation'].create({'data': {'blob_size': 1}, 'guid': '1', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) - os.utime('db/implementation/1/1', (ts - 1.5 * 86400, ts - 1.5 * 86400)) - volume['implementation'].create({'data': {'blob_size': 1}, 'guid': '2', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) - os.utime('db/implementation/2/2', (ts - 2.5 * 86400, ts - 2.5 * 86400)) - volume['implementation'].create({'data': {'blob_size': 1}, 'guid': '3', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) - os.utime('db/implementation/3/3', (ts - 3.5 * 86400, ts - 3.5 * 86400)) + volume = db.Volume('db', [Context, Release]) + volume['release'].create({'data': {'blob_size': 1}, 'guid': '1', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + os.utime('db/release/1/1', (ts - 1.5 * 86400, ts - 1.5 * 86400)) + volume['release'].create({'data': {'blob_size': 1}, 'guid': '2', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + os.utime('db/release/2/2', (ts - 2.5 * 86400, ts - 2.5 * 86400)) + volume['release'].create({'data': {'blob_size': 1}, 'guid': '3', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + os.utime('db/release/3/3', (ts - 3.5 * 86400, ts - 3.5 * 86400)) cache = Cache(volume) cache_lifetime.value = 4 cache.recycle() - assert volume['implementation'].exists('1') - assert volume['implementation'].exists('2') - assert volume['implementation'].exists('3') + assert volume['release'].exists('1') + assert volume['release'].exists('2') + assert volume['release'].exists('3') cache_lifetime.value = 3 cache.recycle() - assert volume['implementation'].exists('1') - assert volume['implementation'].exists('2') - assert not volume['implementation'].exists('3') + assert volume['release'].exists('1') + assert volume['release'].exists('2') + assert not volume['release'].exists('3') cache_lifetime.value = 1 cache.recycle() - assert not volume['implementation'].exists('1') - assert not volume['implementation'].exists('2') - assert not volume['implementation'].exists('3') + assert not volume['release'].exists('1') + assert not volume['release'].exists('2') + assert not volume['release'].exists('3') cache.recycle() def test_checkin(self): - volume = db.Volume('db', [Context, Implementation]) + volume = db.Volume('db', [Context, Release]) cache = Cache(volume) - volume['implementation'].create({'guid': '1', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) - volume['implementation'].create({'guid': '2', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) - volume['implementation'].create({'guid': '3', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + volume['release'].create({'guid': '1', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + volume['release'].create({'guid': '2', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + volume['release'].create({'guid': '3', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) cache.checkin('1', 1) self.assertEqual(['1'], [i for i in cache]) @@ -229,7 +229,7 @@ class CacheTest(tests.Test): conn = IPCConnection() self.statvfs.f_blocks = 0 - impl1 = conn.upload(['implementation'], StringIO(self.zips(['TestActivity/activity/activity.info', [ + impl1 = conn.upload(['release'], StringIO(self.zips(['TestActivity/activity/activity.info', [ '[Activity]', 'name = TestActivity', 'bundle_id = context', @@ -242,13 +242,13 @@ class CacheTest(tests.Test): conn.put(['context', 'context'], True, cmd='clone') self.assertEqual([], [i for i in self.client_routes._cache]) - assert local_volume['implementation'].exists(impl1) + assert local_volume['release'].exists(impl1) conn.put(['context', 'context'], False, cmd='clone') self.assertEqual([impl1], [i for i in self.client_routes._cache]) - assert local_volume['implementation'].exists(impl1) + assert local_volume['release'].exists(impl1) - impl2 = conn.upload(['implementation'], StringIO(self.zips(['TestActivity/activity/activity.info', [ + impl2 = conn.upload(['release'], StringIO(self.zips(['TestActivity/activity/activity.info', [ '[Activity]', 'name = TestActivity', 'bundle_id = context', @@ -262,21 +262,21 @@ class CacheTest(tests.Test): 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) - assert local_volume['implementation'].exists(impl2) + assert local_volume['release'].exists(impl1) + assert local_volume['release'].exists(impl2) conn.put(['context', 'context'], False, cmd='clone') self.assertEqual([impl2, impl1], [i for i in self.client_routes._cache]) - assert local_volume['implementation'].exists(impl1) - assert local_volume['implementation'].exists(impl2) + assert local_volume['release'].exists(impl1) + assert local_volume['release'].exists(impl2) def test_Acquiring(self): - volume = db.Volume('db', [Context, Implementation]) + volume = db.Volume('db', [Context, Release]) cache = Cache(volume) - volume['implementation'].create({'guid': '1', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) - volume['implementation'].create({'guid': '2', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) - volume['implementation'].create({'guid': '3', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + volume['release'].create({'guid': '1', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + volume['release'].create({'guid': '2', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) + volume['release'].create({'guid': '3', 'context': 'context', 'version': '1', 'license': ['GPL'], 'stability': 'stable'}) cache.checkin('1', 1) self.assertEqual(['1'], [i for i in cache]) diff --git a/tests/units/client/offline_routes.py b/tests/units/client/offline_routes.py index 866e5d9..a0d5045 100755 --- a/tests/units/client/offline_routes.py +++ b/tests/units/client/offline_routes.py @@ -10,7 +10,7 @@ from os.path import exists from __init__ import tests, src_root from sugar_network import client, model -from sugar_network.client import IPCConnection, implementations, packagekit +from sugar_network.client import IPCConnection, releases, packagekit from sugar_network.client.routes import ClientRoutes from sugar_network.model.user import User from sugar_network.model.report import Report @@ -22,7 +22,7 @@ class OfflineRoutes(tests.Test): def setUp(self, fork_num=0): tests.Test.setUp(self, fork_num) - self.override(implementations, '_activity_id_new', lambda: 'activity_id') + self.override(releases, '_activity_id_new', lambda: 'activity_id') def test_whoami(self): ipc = self.start_offline_client() @@ -70,24 +70,24 @@ class OfflineRoutes(tests.Test): 'summary': 'summary', 'description': 'description', }) - impl1 = ipc.post(['implementation'], { + impl1 = ipc.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '1', 'stability': 'stable', 'notes': '', }) - self.home_volume['implementation'].update(impl1, {'data': { + self.home_volume['release'].update(impl1, {'data': { 'spec': {'*-*': {}}, }}) - impl2 = ipc.post(['implementation'], { + impl2 = ipc.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '2', 'stability': 'stable', 'notes': '', }) - self.home_volume['implementation'].update(impl2, {'data': { + self.home_volume['release'].update(impl2, {'data': { 'spec': {'*-*': { 'requires': { 'dep1': {}, @@ -99,7 +99,7 @@ class OfflineRoutes(tests.Test): }}) self.assertEqual({ - 'implementations': [ + 'releases': [ { 'version': '1', 'stability': 'stable', @@ -107,7 +107,7 @@ class OfflineRoutes(tests.Test): 'license': ['GPLv3+'], 'layer': ['local'], 'author': {}, - 'ctime': self.home_volume['implementation'].get(impl1).ctime, + 'ctime': self.home_volume['release'].get(impl1).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': {'spec': {'*-*': {}}}, @@ -119,7 +119,7 @@ class OfflineRoutes(tests.Test): 'license': ['GPLv3+'], 'layer': ['local'], 'author': {}, - 'ctime': self.home_volume['implementation'].get(impl2).ctime, + 'ctime': self.home_volume['release'].get(impl2).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { @@ -315,7 +315,7 @@ class OfflineRoutes(tests.Test): 'license=Public Domain', ]) blob = self.zips(['TestActivity/activity/activity.info', activity_info]) - impl = ipc.upload(['implementation'], StringIO(blob), cmd='submit', initial=True) + impl = ipc.upload(['release'], StringIO(blob), cmd='submit', initial=True) ipc.put(['context', 'bundle_id'], True, cmd='clone') solution = [{ @@ -324,10 +324,10 @@ class OfflineRoutes(tests.Test): 'license': ['Public Domain'], 'stability': 'stable', 'version': '1', - 'path': tests.tmpdir + '/client/implementation/%s/%s/data.blob' % (impl[:2], impl), + 'path': tests.tmpdir + '/client/release/%s/%s/data.blob' % (impl[:2], impl), 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { @@ -338,7 +338,7 @@ class OfflineRoutes(tests.Test): 'spec': {'*-*': {'commands': {'activity': {'exec': 'true'}}, 'requires': {}}}, }, }] - assert local['implementation'].exists(impl) + assert local['release'].exists(impl) self.assertEqual( [client.api_url.value, ['stable'], solution], json.load(file('solutions/bu/bundle_id'))) @@ -353,7 +353,7 @@ class OfflineRoutes(tests.Test): {'event': 'exit', 'activity_id': 'activity_id'}, ], [i for i in ipc.get(['context', 'bundle_id'], cmd='launch', foo='bar')]) - assert local['implementation'].exists(impl) + assert local['release'].exists(impl) self.assertEqual( [client.api_url.value, ['stable'], solution], json.load(file('solutions/bu/bundle_id'))) @@ -387,14 +387,14 @@ Can't find all required implementations: ], [i for i in ipc.get(['context', context], cmd='launch')]) - impl = ipc.post(['implementation'], { + impl = ipc.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '1', 'stability': 'stable', 'layer': ['origin'], }) - self.home_volume['implementation'].update(impl, {'data': { + self.home_volume['release'].update(impl, {'data': { 'spec': { '*-*': { 'commands': {'activity': {'exec': 'true'}}, @@ -428,14 +428,14 @@ Can't find all required implementations: 'summary': 'summary', 'description': 'description', }) - impl = ipc.post(['implementation'], { + impl = ipc.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '1', 'stability': 'stable', 'layer': ['origin'], }) - self.home_volume['implementation'].update(impl, {'data': { + self.home_volume['release'].update(impl, {'data': { 'spec': { '*-*': { 'commands': {'activity': {'exec': 'true'}}, @@ -473,7 +473,7 @@ Can't find all required implementations: 'version': '1', 'layer': ['origin', 'local'], 'author': {}, - 'ctime': self.home_volume['implementation'].get(impl).ctime, + 'ctime': self.home_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { diff --git a/tests/units/client/online_routes.py b/tests/units/client/online_routes.py index 064a9bb..0431934 100755 --- a/tests/units/client/online_routes.py +++ b/tests/units/client/online_routes.py @@ -15,7 +15,7 @@ from os.path import exists, lexists, basename from __init__ import tests, src_root from sugar_network import client, db, model -from sugar_network.client import IPCConnection, journal, routes, implementations +from sugar_network.client import IPCConnection, journal, routes, releases from sugar_network.toolkit import coroutine, http from sugar_network.toolkit.spec import Spec from sugar_network.client.routes import ClientRoutes, Request, Response @@ -24,7 +24,7 @@ from sugar_network.db import Volume, Resource from sugar_network.model.user import User from sugar_network.model.report import Report from sugar_network.model.context import Context -from sugar_network.model.implementation import Implementation +from sugar_network.model.release import Release from sugar_network.model.artifact import Artifact from sugar_network.toolkit.router import route from sugar_network.toolkit import Option @@ -36,7 +36,7 @@ class OnlineRoutes(tests.Test): def setUp(self, fork_num=0): tests.Test.setUp(self, fork_num) - self.override(implementations, '_activity_id_new', lambda: 'activity_id') + self.override(releases, '_activity_id_new', lambda: 'activity_id') def test_whoami(self): self.start_online_client() @@ -150,24 +150,24 @@ class OnlineRoutes(tests.Test): 'summary': 'summary', 'description': 'description', }) - impl1 = ipc.post(['implementation'], { + impl1 = ipc.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '1', 'stability': 'stable', 'notes': '', }) - self.node_volume['implementation'].update(impl1, {'data': { + self.node_volume['release'].update(impl1, {'data': { 'spec': {'*-*': {}}, }}) - impl2 = ipc.post(['implementation'], { + impl2 = ipc.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '2', 'stability': 'stable', 'notes': '', }) - self.node_volume['implementation'].update(impl2, {'data': { + self.node_volume['release'].update(impl2, {'data': { 'spec': {'*-*': { 'requires': { 'dep1': {}, @@ -182,7 +182,7 @@ class OnlineRoutes(tests.Test): }}) self.assertEqual({ - 'implementations': [ + 'releases': [ { 'version': '1', 'stability': 'stable', @@ -190,7 +190,7 @@ class OnlineRoutes(tests.Test): 'license': ['GPLv3+'], 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl1).ctime, + 'ctime': self.node_volume['release'].get(impl1).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': {'spec': {'*-*': {}}}, @@ -202,7 +202,7 @@ class OnlineRoutes(tests.Test): 'license': ['GPLv3+'], 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl2).ctime, + 'ctime': self.node_volume['release'].get(impl2).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { @@ -407,7 +407,7 @@ class OnlineRoutes(tests.Test): sorted([(i.guid, i['layer']) for i in local['context'].find(reply='layer')[0]])) def test_clone_Fails(self): - self.start_online_client([User, Context, Implementation]) + self.start_online_client([User, Context, Release]) conn = IPCConnection() self.assertEqual([ @@ -438,14 +438,14 @@ Can't find all required implementations: assert not exists('solutions/%s/%s' % (context[:2], context)) - impl = conn.post(['implementation'], { + impl = conn.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '1', 'stability': 'stable', 'notes': '', }) - self.node_volume['implementation'].update(impl, {'data': { + self.node_volume['release'].update(impl, {'data': { 'blob_size': 1, 'spec': { '*-*': { @@ -471,10 +471,10 @@ Can't find all required implementations: 'license': ['GPLv3+'], 'stability': 'stable', 'version': '1', - 'path': tests.tmpdir + '/client/implementation/%s/%s/data.blob' % (impl[:2], impl), + 'path': tests.tmpdir + '/client/release/%s/%s/data.blob' % (impl[:2], impl), 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { @@ -496,7 +496,7 @@ Can't find all required implementations: assert not exists('solutions/%s/%s' % (context[:2], context)) def test_clone_Content(self): - local = self.start_online_client([User, Context, Implementation]) + local = self.start_online_client([User, Context, Release]) ipc = IPCConnection() events = [] @@ -512,7 +512,7 @@ Can't find all required implementations: 'summary': 'summary', 'description': 'description', }) - impl = ipc.post(['implementation'], { + impl = ipc.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '1', @@ -520,7 +520,7 @@ Can't find all required implementations: 'notes': '', }) blob = 'content' - self.node_volume['implementation'].update(impl, {'data': {'blob': StringIO(blob), 'foo': 'bar'}}) + self.node_volume['release'].update(impl, {'data': {'blob': StringIO(blob), 'foo': 'bar'}}) clone_path = 'client/context/%s/%s/.clone' % (context[:2], context) solution = [{ 'guid': impl, @@ -530,7 +530,7 @@ Can't find all required implementations: 'stability': 'stable', 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { @@ -577,8 +577,8 @@ Can't find all required implementations: 'version': '1', 'stability': 'stable', }, - local['implementation'].get(impl).properties(['context', 'license', 'version', 'stability'])) - blob_path = 'client/implementation/%s/%s/data.blob' % (impl[:2], impl) + local['release'].get(impl).properties(['context', 'license', 'version', 'stability'])) + blob_path = 'client/release/%s/%s/data.blob' % (impl[:2], impl) solution[0]['path'] = tests.tmpdir + '/' + blob_path self.assertEqual({ 'seqno': 5, @@ -587,7 +587,7 @@ Can't find all required implementations: 'mtime': int(os.stat(blob_path[:-5]).st_mtime), 'foo': 'bar', }, - local['implementation'].get(impl).meta('data')) + local['release'].get(impl).meta('data')) self.assertEqual('content', file(blob_path).read()) assert exists(clone_path + '/data.blob') self.assertEqual( @@ -616,7 +616,7 @@ Can't find all required implementations: 'title': {'en-us': 'title'}, }, local['context'].get(context).properties(['layer', 'type', 'author', 'title'])) - blob_path = 'client/implementation/%s/%s/data.blob' % (impl[:2], impl) + blob_path = 'client/release/%s/%s/data.blob' % (impl[:2], impl) self.assertEqual({ 'seqno': 5, 'blob_size': len(blob), @@ -624,7 +624,7 @@ Can't find all required implementations: 'mtime': int(os.stat(blob_path[:-5]).st_mtime), 'foo': 'bar', }, - local['implementation'].get(impl).meta('data')) + local['release'].get(impl).meta('data')) self.assertEqual('content', file(blob_path).read()) assert not lexists(clone_path) self.assertEqual( @@ -651,7 +651,7 @@ Can't find all required implementations: json.load(file('solutions/%s/%s' % (context[:2], context)))) def test_clone_Activity(self): - local = self.start_online_client([User, Context, Implementation]) + local = self.start_online_client([User, Context, Release]) ipc = IPCConnection() events = [] @@ -671,9 +671,9 @@ Can't find all required implementations: 'license=Public Domain', ]) blob = self.zips(['TestActivity/activity/activity.info', activity_info]) - impl = ipc.upload(['implementation'], StringIO(blob), cmd='submit', initial=True) + impl = ipc.upload(['release'], StringIO(blob), cmd='submit', initial=True) clone_path = 'client/context/bu/bundle_id/.clone' - blob_path = tests.tmpdir + '/client/implementation/%s/%s/data.blob' % (impl[:2], impl) + blob_path = tests.tmpdir + '/client/release/%s/%s/data.blob' % (impl[:2], impl) solution = [{ 'guid': impl, 'context': 'bundle_id', @@ -682,7 +682,7 @@ Can't find all required implementations: 'version': '1', 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { @@ -731,7 +731,7 @@ Can't find all required implementations: 'version': '1', 'stability': 'stable', }, - local['implementation'].get(impl).properties(['context', 'license', 'version', 'stability'])) + local['release'].get(impl).properties(['context', 'license', 'version', 'stability'])) self.assertEqual({ 'seqno': 5, 'unpack_size': len(activity_info), @@ -747,7 +747,7 @@ Can't find all required implementations: }, }, }, - local['implementation'].get(impl).meta('data')) + local['release'].get(impl).meta('data')) self.assertEqual(activity_info, file(blob_path + '/activity/activity.info').read()) assert exists(clone_path + '/data.blob/activity/activity.info') self.assertEqual( @@ -791,7 +791,7 @@ Can't find all required implementations: }, }, }, - local['implementation'].get(impl).meta('data')) + local['release'].get(impl).meta('data')) self.assertEqual(activity_info, file(blob_path + '/activity/activity.info').read()) assert not exists(clone_path) self.assertEqual( @@ -818,7 +818,7 @@ Can't find all required implementations: json.load(file('solutions/bu/bundle_id'))) def test_clone_ActivityWithStabilityPreferences(self): - local = self.start_online_client([User, Context, Implementation]) + local = self.start_online_client([User, Context, Release]) ipc = IPCConnection() activity_info1 = '\n'.join([ @@ -831,7 +831,7 @@ Can't find all required implementations: 'license = Public Domain', ]) blob1 = self.zips(['TestActivity/activity/activity.info', activity_info1]) - impl1 = ipc.upload(['implementation'], StringIO(blob1), cmd='submit', initial=True) + impl1 = ipc.upload(['release'], StringIO(blob1), cmd='submit', initial=True) activity_info2 = '\n'.join([ '[Activity]', @@ -844,7 +844,7 @@ Can't find all required implementations: 'stability = buggy', ]) blob2 = self.zips(['TestActivity/activity/activity.info', activity_info2]) - impl2 = ipc.upload(['implementation'], StringIO(blob2), cmd='submit', initial=True) + impl2 = ipc.upload(['release'], StringIO(blob2), cmd='submit', initial=True) self.assertEqual( 'ready', @@ -852,7 +852,7 @@ Can't find all required implementations: coroutine.dispatch() self.assertEqual({'layer': ['clone']}, ipc.get(['context', 'bundle_id'], reply='layer')) - self.assertEqual([impl1], [i.guid for i in local['implementation'].find()[0]]) + self.assertEqual([impl1], [i.guid for i in local['release'].find()[0]]) self.assertEqual(impl1, basename(os.readlink('client/context/bu/bundle_id/.clone'))) self.touch(('config', [ @@ -870,11 +870,11 @@ Can't find all required implementations: coroutine.dispatch() self.assertEqual({'layer': ['clone']}, ipc.get(['context', 'bundle_id'], reply='layer')) - self.assertEqual([impl1, impl2], [i.guid for i in local['implementation'].find()[0]]) + self.assertEqual([impl1, impl2], [i.guid for i in local['release'].find()[0]]) self.assertEqual(impl2, basename(os.readlink('client/context/bu/bundle_id/.clone'))) def test_clone_Head(self): - local = self.start_online_client([User, Context, Implementation]) + local = self.start_online_client([User, Context, Release]) ipc = IPCConnection() activity_info = '\n'.join([ @@ -887,8 +887,8 @@ Can't find all required implementations: 'license = Public Domain', ]) blob = self.zips(['TestActivity/activity/activity.info', activity_info]) - impl = ipc.upload(['implementation'], StringIO(blob), cmd='submit', initial=True) - blob_path = 'master/implementation/%s/%s/data.blob' % (impl[:2], impl) + impl = ipc.upload(['release'], StringIO(blob), cmd='submit', initial=True) + blob_path = 'master/release/%s/%s/data.blob' % (impl[:2], impl) self.assertEqual({ 'guid': impl, @@ -898,7 +898,7 @@ Can't find all required implementations: 'context': 'bundle_id', 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { @@ -914,7 +914,7 @@ Can't find all required implementations: self.assertEqual( 'ready', [i for i in ipc.put(['context', 'bundle_id'], True, cmd='clone')][-1]['event']) - blob_path = tests.tmpdir + '/client/implementation/%s/%s/data.blob' % (impl[:2], impl) + blob_path = tests.tmpdir + '/client/release/%s/%s/data.blob' % (impl[:2], impl) self.assertEqual({ 'guid': impl, @@ -924,7 +924,7 @@ Can't find all required implementations: 'context': 'bundle_id', 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { @@ -941,7 +941,7 @@ Can't find all required implementations: ipc.head(['context', 'bundle_id'], cmd='clone')) def test_launch_Activity(self): - local = self.start_online_client([User, Context, Implementation]) + local = self.start_online_client([User, Context, Release]) ipc = IPCConnection() activity_info = '\n'.join([ @@ -954,7 +954,7 @@ Can't find all required implementations: 'license=Public Domain', ]) blob = self.zips(['TestActivity/activity/activity.info', activity_info]) - impl = ipc.upload(['implementation'], StringIO(blob), cmd='submit', initial=True) + impl = ipc.upload(['release'], StringIO(blob), cmd='submit', initial=True) coroutine.sleep(.1) solution = [{ @@ -965,7 +965,7 @@ Can't find all required implementations: 'version': '1', 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { @@ -977,7 +977,7 @@ Can't find all required implementations: }, }] downloaded_solution = copy.deepcopy(solution) - downloaded_solution[0]['path'] = tests.tmpdir + '/client/implementation/%s/%s/data.blob' % (impl[:2], impl) + downloaded_solution[0]['path'] = tests.tmpdir + '/client/release/%s/%s/data.blob' % (impl[:2], impl) log_path = tests.tmpdir + '/.sugar/default/logs/bundle_id.log' self.assertEqual([ {'event': 'launch', 'foo': 'bar', 'activity_id': 'activity_id'}, @@ -985,7 +985,7 @@ Can't find all required implementations: {'event': 'exit', 'activity_id': 'activity_id'}, ], [i for i in ipc.get(['context', 'bundle_id'], cmd='launch', foo='bar')]) - assert local['implementation'].exists(impl) + assert local['release'].exists(impl) self.assertEqual( [client.api_url.value, ['stable'], downloaded_solution], json.load(file('solutions/bu/bundle_id'))) @@ -999,7 +999,7 @@ Can't find all required implementations: 'activity_version = 2', 'license=Public Domain', ]]) - impl = ipc.upload(['implementation'], StringIO(blob), cmd='submit') + impl = ipc.upload(['release'], StringIO(blob), cmd='submit') coroutine.sleep(.1) shutil.rmtree('solutions') @@ -1009,10 +1009,10 @@ Can't find all required implementations: 'license': ['Public Domain'], 'stability': 'stable', 'version': '2', - 'path': tests.tmpdir + '/client/implementation/%s/%s/data.blob' % (impl[:2], impl), + 'path': tests.tmpdir + '/client/release/%s/%s/data.blob' % (impl[:2], impl), 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { @@ -1030,7 +1030,7 @@ Can't find all required implementations: {'event': 'exit', 'activity_id': 'activity_id'}, ], [i for i in ipc.get(['context', 'bundle_id'], cmd='launch', foo='bar')]) - assert local['implementation'].exists(impl) + assert local['release'].exists(impl) self.assertEqual( [client.api_url.value, ['stable'], solution], json.load(file('solutions/bu/bundle_id'))) @@ -1045,7 +1045,7 @@ Can't find all required implementations: {'event': 'exit', 'activity_id': 'activity_id'}, ], [i for i in ipc.get(['context', 'bundle_id'], cmd='launch', foo='bar')]) - assert local['implementation'].exists(impl) + assert local['release'].exists(impl) self.assertEqual( [client.api_url.value, ['stable'], solution], json.load(file('solutions/bu/bundle_id'))) @@ -1058,13 +1058,13 @@ Can't find all required implementations: {'event': 'exit', 'activity_id': 'activity_id'}, ], [i for i in ipc.get(['context', 'bundle_id'], cmd='launch', foo='bar')]) - assert local['implementation'].exists(impl) + assert local['release'].exists(impl) self.assertEqual( [client.api_url.value, ['stable'], solution], json.load(file('solutions/bu/bundle_id'))) def test_launch_Fails(self): - local = self.start_online_client([User, Context, Implementation]) + local = self.start_online_client([User, Context, Release]) ipc = IPCConnection() self.assertEqual([ @@ -1104,7 +1104,7 @@ Can't find all required implementations: 'license=Public Domain', ]) blob = self.zips(['TestActivity/activity/activity.info', activity_info]) - impl = ipc.upload(['implementation'], StringIO(blob), cmd='submit', initial=True) + impl = ipc.upload(['release'], StringIO(blob), cmd='submit', initial=True) solution = [{ 'guid': impl, @@ -1112,10 +1112,10 @@ Can't find all required implementations: 'license': ['Public Domain'], 'stability': 'stable', 'version': '1', - 'path': tests.tmpdir + '/client/implementation/%s/%s/data.blob' % (impl[:2], impl), + 'path': tests.tmpdir + '/client/release/%s/%s/data.blob' % (impl[:2], impl), 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { @@ -1140,7 +1140,7 @@ Can't find all required implementations: ]}, ], [i for i in ipc.get(['context', 'bundle_id'], cmd='launch', foo='bar')]) - assert local['implementation'].exists(impl) + assert local['release'].exists(impl) self.assertEqual( [client.api_url.value, ['stable'], solution], json.load(file('solutions/bu/bundle_id'))) @@ -1163,14 +1163,14 @@ Can't find all required implementations: coroutine.sleep(1.1) - impl1 = ipc.post(['implementation'], { + impl1 = ipc.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '1', 'stability': 'stable', 'notes': '', }) - self.node_volume['implementation'].update(impl1, {'data': { + self.node_volume['release'].update(impl1, {'data': { 'spec': {'*-*': {}}, }}) assert self.client_routes._node_mtime > mtime @@ -1178,14 +1178,14 @@ Can't find all required implementations: mtime = self.client_routes._node_mtime coroutine.sleep(1.1) - impl2 = ipc.post(['implementation'], { + impl2 = ipc.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '2', 'stability': 'stable', 'notes': '', }) - self.node_volume['implementation'].update(impl2, {'data': { + self.node_volume['release'].update(impl2, {'data': { 'spec': {'*-*': { 'requires': { 'dep1': {}, @@ -1223,7 +1223,7 @@ Can't find all required implementations: ipc.get(['context', guid], reply=['title'])) def test_RestrictLayers(self): - self.start_online_client([User, Context, Implementation, Artifact]) + self.start_online_client([User, Context, Release, Artifact]) ipc = IPCConnection() context = ipc.post(['context'], { @@ -1233,7 +1233,7 @@ Can't find all required implementations: 'description': 'description', 'layer': 'public', }) - impl = ipc.post(['implementation'], { + impl = ipc.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '1', @@ -1241,7 +1241,7 @@ Can't find all required implementations: 'notes': '', 'layer': 'public', }) - self.node_volume['implementation'].update(impl, {'data': { + self.node_volume['release'].update(impl, {'data': { 'spec': {'*-*': {}}, }}) @@ -1257,23 +1257,23 @@ Can't find all required implementations: self.assertEqual( [{'guid': impl, 'layer': ['origin', 'public']}], - ipc.get(['implementation'], reply=['guid', 'layer'])['result']) + ipc.get(['release'], reply=['guid', 'layer'])['result']) self.assertEqual( [], - ipc.get(['implementation'], reply=['guid', 'layer'], layer='foo')['result']) + ipc.get(['release'], reply=['guid', 'layer'], layer='foo')['result']) self.assertEqual( [{'guid': impl, 'layer': ['origin', 'public']}], - ipc.get(['implementation'], reply=['guid', 'layer'], layer='public')['result']) + ipc.get(['release'], reply=['guid', 'layer'], layer='public')['result']) self.assertEqual({ - 'implementations': [{ + 'releases': [{ 'stability': 'stable', 'guid': impl, 'version': '1', 'license': ['GPLv3+'], 'layer': ['origin', 'public'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': {'spec': {'*-*': {}}}, @@ -1281,18 +1281,18 @@ Can't find all required implementations: }, ipc.get(['context', context], cmd='feed')) self.assertEqual({ - 'implementations': [], + 'releases': [], }, ipc.get(['context', context], cmd='feed', layer='foo')) self.assertEqual({ - 'implementations': [{ + 'releases': [{ 'stability': 'stable', 'guid': impl, 'version': '1', 'license': ['GPLv3+'], 'layer': ['origin', 'public'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': {'spec': {'*-*': {}}}, @@ -1314,31 +1314,31 @@ Can't find all required implementations: self.assertEqual( [], - ipc.get(['implementation'], reply=['guid', 'layer'])['result']) + ipc.get(['release'], reply=['guid', 'layer'])['result']) self.assertEqual( [], - ipc.get(['implementation'], reply=['guid', 'layer'], layer='foo')['result']) + ipc.get(['release'], reply=['guid', 'layer'], layer='foo')['result']) self.assertEqual( [{'guid': impl, 'layer': ['origin', 'public']}], - ipc.get(['implementation'], reply=['guid', 'layer'], layer='public')['result']) + ipc.get(['release'], reply=['guid', 'layer'], layer='public')['result']) self.assertEqual({ - 'implementations': [], + 'releases': [], }, ipc.get(['context', context], cmd='feed')) self.assertEqual({ - 'implementations': [], + 'releases': [], }, ipc.get(['context', context], cmd='feed', layer='foo')) self.assertEqual({ - 'implementations': [{ + 'releases': [{ 'stability': 'stable', 'guid': impl, 'version': '1', 'license': ['GPLv3+'], 'layer': ['origin', 'public'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': {'spec': {'*-*': {}}}, @@ -1404,7 +1404,7 @@ Can't find all required implementations: assert trigger.wait(.1) is not None def test_ContentDisposition(self): - self.start_online_client([User, Context, Implementation, Artifact]) + self.start_online_client([User, Context, Release, Artifact]) ipc = IPCConnection() artifact = ipc.post(['artifact'], { @@ -1580,7 +1580,7 @@ Can't find all required implementations: assert not cp.inline() def test_SubmitReport(self): - self.home_volume = self.start_online_client([User, Context, Implementation, Report]) + self.home_volume = self.start_online_client([User, Context, Release, Report]) ipc = IPCConnection() self.touch( diff --git a/tests/units/client/implementations.py b/tests/units/client/releases.py index b77c558..9c99cec 100755 --- a/tests/units/client/implementations.py +++ b/tests/units/client/releases.py @@ -15,18 +15,18 @@ from os.path import exists, dirname from __init__ import tests -from sugar_network.client import journal, implementations, cache_limit +from sugar_network.client import journal, releases, cache_limit from sugar_network.toolkit import coroutine, lsb_release from sugar_network.node import obs from sugar_network.model.user import User from sugar_network.model.context import Context -from sugar_network.model.implementation import Implementation +from sugar_network.model.release import Release from sugar_network.client import IPCConnection, packagekit, solver from sugar_network.toolkit import http, Option from sugar_network import client -class Implementations(tests.Test): +class Releases(tests.Test): def setUp(self, fork_num=0): tests.Test.setUp(self, fork_num) @@ -47,7 +47,7 @@ class Implementations(tests.Test): 'license = Public Domain', 'requires = dep1; dep2', ]]) - impl = conn.upload(['implementation'], StringIO(blob), cmd='submit', initial=True) + impl = conn.upload(['release'], StringIO(blob), cmd='submit', initial=True) conn.post(['context'], { 'guid': 'dep1', @@ -121,11 +121,11 @@ class Implementations(tests.Test): 'TestActivity/file1', 'TestActivity/test/file2', ) - impl = conn.upload(['implementation'], StringIO(blob), cmd='submit', initial=True) + impl = conn.upload(['release'], StringIO(blob), cmd='submit', initial=True) conn.put(['context', 'bundle_id'], True, cmd='clone') - path = 'client/implementation/%s/%s/data.blob/' % (impl[:2], impl) + path = 'client/release/%s/%s/data.blob/' % (impl[:2], impl) assert os.access(path + 'activity/foo', os.X_OK) assert os.access(path + 'bin/bar', os.X_OK) assert os.access(path + 'bin/probe', os.X_OK) @@ -147,17 +147,17 @@ class Implementations(tests.Test): 'stability = stable', ]) blob = self.zips(['TestActivity/activity/activity.info', activity_info]) - impl = conn.upload(['implementation'], StringIO(blob), cmd='submit', initial=True) + impl = conn.upload(['release'], StringIO(blob), cmd='submit', initial=True) solution = ['http://127.0.0.1:8888', ['stable'], [{ 'license': ['Public Domain'], 'stability': 'stable', 'version': '1', 'context': 'bundle_id', - 'path': tests.tmpdir + '/client/implementation/%s/%s/data.blob' % (impl[:2], impl), + 'path': tests.tmpdir + '/client/release/%s/%s/data.blob' % (impl[:2], impl), 'guid': impl, 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { @@ -278,7 +278,7 @@ class Implementations(tests.Test): self.start_online_client() conn = IPCConnection() - conn.upload(['implementation'], StringIO(self.zips(['TestActivity/activity/activity.info', [ + conn.upload(['release'], StringIO(self.zips(['TestActivity/activity/activity.info', [ '[Activity]', 'name = TestActivity', 'bundle_id = bundle_id', @@ -288,7 +288,7 @@ class Implementations(tests.Test): 'license = Public Domain', 'stability = stable', ]])), cmd='submit', initial=True) - conn.upload(['implementation'], StringIO(self.zips(['TestActivity/activity/activity.info', [ + conn.upload(['release'], StringIO(self.zips(['TestActivity/activity/activity.info', [ '[Activity]', 'name = TestActivity', 'bundle_id = bundle_id', @@ -298,7 +298,7 @@ class Implementations(tests.Test): 'license = Public Domain', 'stability = testing', ]])), cmd='submit') - conn.upload(['implementation'], StringIO(self.zips(['TestActivity/activity/activity.info', [ + conn.upload(['release'], StringIO(self.zips(['TestActivity/activity/activity.info', [ '[Activity]', 'name = TestActivity', 'bundle_id = bundle_id', @@ -341,7 +341,7 @@ class Implementations(tests.Test): self.start_online_client() conn = IPCConnection() - app = conn.upload(['implementation'], StringIO(self.zips( + app = conn.upload(['release'], StringIO(self.zips( ['TestActivity/activity/activity.info', [ '[Activity]', 'name = TestActivity', @@ -364,13 +364,13 @@ class Implementations(tests.Test): 'summary': 'summary', 'description': 'description', }) - doc = conn.post(['implementation'], { + doc = conn.post(['release'], { 'context': 'document', 'license': 'GPLv3+', 'version': '1', 'stability': 'stable', }) - self.node_volume['implementation'].update(doc, {'data': { + self.node_volume['release'].update(doc, {'data': { 'mime_type': 'application/octet-stream', 'blob': StringIO('content'), }}) @@ -394,10 +394,10 @@ class Implementations(tests.Test): 'license = Public Domain', ]], ) - impl = conn.upload(['implementation'], StringIO(blob), cmd='submit', initial=True) + impl = conn.upload(['release'], StringIO(blob), cmd='submit', initial=True) conn.put(['context', 'bundle_id'], True, cmd='clone') - doc = home_volume['implementation'].get(impl) + doc = home_volume['release'].get(impl) assert doc.meta('ctime') is not None assert doc.meta('mtime') is not None assert doc.meta('seqno') is not None @@ -414,7 +414,7 @@ class Implementations(tests.Test): volume = self.start_online_client() conn = IPCConnection() - app = conn.upload(['implementation'], StringIO(self.zips( + app = conn.upload(['release'], StringIO(self.zips( ['TestActivity/activity/activity.info', [ '[Activity]', 'name = TestActivity', @@ -437,13 +437,13 @@ class Implementations(tests.Test): 'summary': 'summary', 'description': 'description', }) - doc = conn.post(['implementation'], { + doc = conn.post(['release'], { 'context': 'document', 'license': 'GPLv3+', 'version': '1', 'stability': 'stable', }) - self.node_volume['implementation'].update(doc, {'data': { + self.node_volume['release'].update(doc, {'data': { 'mime_type': 'application/octet-stream', 'blob': StringIO('content'), }}) @@ -460,8 +460,8 @@ class Implementations(tests.Test): cache_limit.value = 10 self.assertRaises(RuntimeError, self.client_routes._cache.ensure, 1, 0) - assert volume['implementation'].exists(app) - assert volume['implementation'].exists(doc) + assert volume['release'].exists(app) + assert volume['release'].exists(doc) self.assertEqual([], [i for i in self.client_routes._cache]) self.assertEqual('exit', next(launch)['event']) @@ -471,7 +471,7 @@ class Implementations(tests.Test): volume = self.start_online_client() conn = IPCConnection() - app = conn.upload(['implementation'], StringIO(self.zips( + app = conn.upload(['release'], StringIO(self.zips( ['TestActivity/activity/activity.info', [ '[Activity]', 'name = TestActivity', diff --git a/tests/units/client/routes.py b/tests/units/client/routes.py index 7103584..0b757f5 100755 --- a/tests/units/client/routes.py +++ b/tests/units/client/routes.py @@ -58,7 +58,7 @@ class RoutesTest(tests.Test): 'summary': 'summary', 'description': 'description', }) - ipc.upload(['implementation'], StringIO(self.zips(['TestActivity/activity/activity.info', [ + ipc.upload(['release'], StringIO(self.zips(['TestActivity/activity/activity.info', [ '[Activity]', 'name = 2', 'bundle_id = context2', @@ -69,7 +69,7 @@ class RoutesTest(tests.Test): 'stability = stable', ]])), cmd='submit', initial=True) guid2 = 'context2' - ipc.upload(['implementation'], StringIO(self.zips(['TestActivity/activity/activity.info', [ + ipc.upload(['release'], StringIO(self.zips(['TestActivity/activity/activity.info', [ '[Activity]', 'name = 3', 'bundle_id = context3', @@ -324,7 +324,7 @@ class RoutesTest(tests.Test): self.start_online_client() ipc = IPCConnection() - guid = ipc.upload(['implementation'], StringIO(self.zips(['TestActivity/activity/activity.info', [ + guid = ipc.upload(['release'], StringIO(self.zips(['TestActivity/activity/activity.info', [ '[Activity]', 'name = name', 'bundle_id = context', @@ -336,21 +336,21 @@ class RoutesTest(tests.Test): ]])), cmd='submit', initial=True) ipc.put(['context', 'context'], True, cmd='clone') ts = time.time() - os.utime('client/implementation/%s/%s' % (guid[:2], guid), (ts - 2 * 86400, ts - 2 * 86400)) + os.utime('client/release/%s/%s' % (guid[:2], guid), (ts - 2 * 86400, ts - 2 * 86400)) self.client_routes.close() self.stop_nodes() home_volume = self.start_online_client() cache_lifetime.value = 1 self.client_routes.recycle() - assert home_volume['implementation'].exists(guid) - assert exists('client/implementation/%s/%s' % (guid[:2], guid)) + assert home_volume['release'].exists(guid) + assert exists('client/release/%s/%s' % (guid[:2], guid)) def test_IgnoreClonesWhileCheckingFreeSpace(self): home_volume = self.start_online_client() ipc = IPCConnection() - guid = ipc.upload(['implementation'], StringIO(self.zips(['TestActivity/activity/activity.info', [ + guid = ipc.upload(['release'], StringIO(self.zips(['TestActivity/activity/activity.info', [ '[Activity]', 'name = name', 'bundle_id = context', @@ -371,14 +371,14 @@ class RoutesTest(tests.Test): cache_limit.value = 10 self.assertRaises(RuntimeError, self.client_routes._cache.ensure, 1, 0) - assert home_volume['implementation'].exists(guid) - assert exists('client/implementation/%s/%s' % (guid[:2], guid)) + assert home_volume['release'].exists(guid) + assert exists('client/release/%s/%s' % (guid[:2], guid)) def test_IgnoreClonesOnRecycle(self): home_volume = self.start_online_client() ipc = IPCConnection() - guid = ipc.upload(['implementation'], StringIO(self.zips(['TestActivity/activity/activity.info', [ + guid = ipc.upload(['release'], StringIO(self.zips(['TestActivity/activity/activity.info', [ '[Activity]', 'name = name', 'bundle_id = context', @@ -390,12 +390,12 @@ class RoutesTest(tests.Test): ]])), cmd='submit', initial=True) ipc.put(['context', 'context'], True, cmd='clone') ts = time.time() - os.utime('client/implementation/%s/%s' % (guid[:2], guid), (ts - 2 * 86400, ts - 2 * 86400)) + os.utime('client/release/%s/%s' % (guid[:2], guid), (ts - 2 * 86400, ts - 2 * 86400)) cache_lifetime.value = 1 self.client_routes.recycle() - assert home_volume['implementation'].exists(guid) - assert exists('client/implementation/%s/%s' % (guid[:2], guid)) + assert home_volume['release'].exists(guid) + assert exists('client/release/%s/%s' % (guid[:2], guid)) def test_LanguagesFallbackInRequests(self): self.start_online_client() diff --git a/tests/units/client/solver.py b/tests/units/client/solver.py index ac2ef52..29e1472 100755 --- a/tests/units/client/solver.py +++ b/tests/units/client/solver.py @@ -34,14 +34,14 @@ class SolverTest(tests.Test): 'description': 'description', 'dependencies': ['dep1', 'dep2'], }) - impl = conn.post(['implementation'], { + impl = conn.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '1', 'stability': 'stable', 'notes': '', }) - self.node_volume['implementation'].update(impl, {'data': { + self.node_volume['release'].update(impl, {'data': { 'spec': { '*-*': { 'commands': { @@ -109,7 +109,7 @@ class SolverTest(tests.Test): {'version': '1', 'context': context, 'guid': impl, 'stability': 'stable', 'license': ['GPLv3+'], 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': {'spec': {'*-*': {'commands': {'activity': {'exec': 'echo'}}, 'requires': @@ -141,14 +141,14 @@ class SolverTest(tests.Test): 'description': 'description', }) - impl = conn.post(['implementation'], { + impl = conn.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '1', 'stability': 'stable', 'notes': '', }) - self.node_volume['implementation'].update(impl, {'data': { + self.node_volume['release'].update(impl, {'data': { 'spec': { '*-*': { 'commands': { @@ -171,7 +171,7 @@ class SolverTest(tests.Test): 'license': ['GPLv3+'], 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': {'spec': {'*-*': {'commands': {'activity': {'exec': 'echo'}}, 'requires': {'sugar': {}}}}}}, @@ -179,7 +179,7 @@ class SolverTest(tests.Test): ], solver.solve(self.client_routes.fallback, context, ['stable'])) - self.node_volume['implementation'].update(impl, {'data': { + self.node_volume['release'].update(impl, {'data': { 'spec': { '*-*': { 'commands': { @@ -202,7 +202,7 @@ class SolverTest(tests.Test): 'license': ['GPLv3+'], 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': {'spec': {'*-*': {'commands': {'activity': {'exec': 'echo'}}, 'requires': @@ -234,14 +234,14 @@ class SolverTest(tests.Test): 'description': 'description', }) - impl = conn.post(['implementation'], { + impl = conn.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '1', 'stability': 'stable', 'notes': '', }) - self.node_volume['implementation'].update(impl, {'data': { + self.node_volume['release'].update(impl, {'data': { 'spec': { '*-*': { 'commands': { @@ -264,7 +264,7 @@ class SolverTest(tests.Test): 'license': ['GPLv3+'], 'layer': ['origin'], 'author': {tests.UID: {'name': 'test', 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl).ctime, + 'ctime': self.node_volume['release'].get(impl).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': {'spec': {'*-*': {'commands': {'activity': {'exec': 'echo'}}, 'requires': {'sugar': {}}}}}}, |