diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/__init__.py | 14 | ||||
-rw-r--r-- | tests/data/node/implementation/im/implementation/guid | 1 | ||||
-rw-r--r-- | tests/data/node/implementation/im/implementation2/guid | 1 | ||||
-rw-r--r-- | tests/data/node/release/re/release/author (renamed from tests/data/node/implementation/im/implementation/author) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/context (renamed from tests/data/node/implementation/im/implementation/context) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/ctime (renamed from tests/data/node/implementation/im/implementation/ctime) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/data (renamed from tests/data/node/implementation/im/implementation/data) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/data.blob (renamed from tests/data/node/implementation/im/implementation/data.blob) | bin | 388553 -> 388553 bytes | |||
-rw-r--r-- | tests/data/node/release/re/release/date (renamed from tests/data/node/implementation/im/implementation/date) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/guid | 1 | ||||
-rw-r--r-- | tests/data/node/release/re/release/layer (renamed from tests/data/node/implementation/im/implementation/layer) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/license (renamed from tests/data/node/implementation/im/implementation/license) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/mtime (renamed from tests/data/node/implementation/im/implementation/mtime) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/notes (renamed from tests/data/node/implementation/im/implementation/notes) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/requires (renamed from tests/data/node/implementation/im/implementation/requires) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/seqno (renamed from tests/data/node/implementation/im/implementation/seqno) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/stability (renamed from tests/data/node/implementation/im/implementation/stability) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/tags (renamed from tests/data/node/implementation/im/implementation/tags) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/user (renamed from tests/data/node/implementation/im/implementation/user) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release/version (renamed from tests/data/node/implementation/im/implementation/version) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/author (renamed from tests/data/node/implementation/im/implementation2/author) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/context (renamed from tests/data/node/implementation/im/implementation2/context) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/ctime (renamed from tests/data/node/implementation/im/implementation2/ctime) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/data (renamed from tests/data/node/implementation/im/implementation2/data) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/data.blob (renamed from tests/data/node/implementation/im/implementation2/data.blob) | bin | 388553 -> 388553 bytes | |||
-rw-r--r-- | tests/data/node/release/re/release2/date (renamed from tests/data/node/implementation/im/implementation2/date) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/guid | 1 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/layer (renamed from tests/data/node/implementation/im/implementation2/layer) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/license (renamed from tests/data/node/implementation/im/implementation2/license) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/mtime (renamed from tests/data/node/implementation/im/implementation2/mtime) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/notes (renamed from tests/data/node/implementation/im/implementation2/notes) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/requires (renamed from tests/data/node/implementation/im/implementation2/requires) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/seqno (renamed from tests/data/node/implementation/im/implementation2/seqno) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/stability (renamed from tests/data/node/implementation/im/implementation2/stability) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/tags (renamed from tests/data/node/implementation/im/implementation2/tags) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/user (renamed from tests/data/node/implementation/im/implementation2/user) | 0 | ||||
-rw-r--r-- | tests/data/node/release/re/release2/version (renamed from tests/data/node/implementation/im/implementation2/version) | 0 | ||||
-rwxr-xr-x | tests/integration/node_client.py | 16 | ||||
-rwxr-xr-x | tests/regression/api.py | 8 | ||||
-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 | ||||
-rw-r--r-- | tests/units/model/__main__.py | 2 | ||||
-rwxr-xr-x | tests/units/model/comment.py | 4 | ||||
-rwxr-xr-x | tests/units/model/release.py (renamed from tests/units/model/implementation.py) | 22 | ||||
-rwxr-xr-x | tests/units/model/review.py | 4 | ||||
-rwxr-xr-x | tests/units/model/routes.py | 8 | ||||
-rwxr-xr-x | tests/units/model/solution.py | 4 | ||||
-rwxr-xr-x | tests/units/node/master.py | 8 | ||||
-rwxr-xr-x | tests/units/node/node.py | 120 | ||||
-rwxr-xr-x | tests/units/node/stats_node.py | 22 | ||||
-rwxr-xr-x | tests/units/node/volume.py | 26 |
56 files changed, 353 insertions, 353 deletions
diff --git a/tests/__init__.py b/tests/__init__.py index 559020f..2e058f5 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -24,7 +24,7 @@ from sugar_network import db, client, node, toolkit, model from sugar_network.client import solver 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.node.master import MasterRoutes from sugar_network.node import stats_user, stats_node, obs, slave, downloads from requests import adapters @@ -123,7 +123,7 @@ class Test(unittest.TestCase): 'sugar_network.model.user', 'sugar_network.model.context', 'sugar_network.model.artifact', - 'sugar_network.model.implementation', + 'sugar_network.model.release', 'sugar_network.model.report', ] @@ -267,7 +267,7 @@ class Test(unittest.TestCase): def start_master(self, classes=None, routes=MasterRoutes): if classes is None: - classes = [User, Context, Implementation] + classes = [User, Context, Release] self.node_volume = db.Volume('master', classes) self.node_routes = routes('guid', self.node_volume) self.node = coroutine.WSGIServer(('127.0.0.1', 8888), Router(self.node_routes)) @@ -277,7 +277,7 @@ class Test(unittest.TestCase): def fork_master(self, classes=None, routes=MasterRoutes): if classes is None: - classes = [User, Context, Implementation] + classes = [User, Context, Release] def node(): volume = db.Volume('master', classes) @@ -291,7 +291,7 @@ class Test(unittest.TestCase): def start_client(self, classes=None, routes=ClientRoutes): if classes is None: - classes = [User, Context, Implementation] + classes = [User, Context, Release] volume = db.Volume('client', classes) self.client_routes = routes(volume, client.api_url.value) self.client = coroutine.WSGIServer( @@ -302,7 +302,7 @@ class Test(unittest.TestCase): def start_online_client(self, classes=None): if classes is None: - classes = [User, Context, Implementation] + classes = [User, Context, Release] self.start_master(classes) volume = db.Volume('client', classes) self.client_routes = ClientRoutes(volume, client.api_url.value) @@ -337,7 +337,7 @@ class Test(unittest.TestCase): node.find_limit.value = 1024 db.index_write_queue.value = 10 - volume = db.Volume('remote', classes or [User, Context, Implementation]) + volume = db.Volume('remote', classes or [User, Context, Release]) self.node_routes = MasterRoutes('guid', volume) httpd = coroutine.WSGIServer(('127.0.0.1', 8888), Router(self.node_routes)) try: diff --git a/tests/data/node/implementation/im/implementation/guid b/tests/data/node/implementation/im/implementation/guid deleted file mode 100644 index 98acb00..0000000 --- a/tests/data/node/implementation/im/implementation/guid +++ /dev/null @@ -1 +0,0 @@ -{"seqno": 3, "value": "implementation"}
\ No newline at end of file diff --git a/tests/data/node/implementation/im/implementation2/guid b/tests/data/node/implementation/im/implementation2/guid deleted file mode 100644 index 98acb00..0000000 --- a/tests/data/node/implementation/im/implementation2/guid +++ /dev/null @@ -1 +0,0 @@ -{"seqno": 3, "value": "implementation"}
\ No newline at end of file diff --git a/tests/data/node/implementation/im/implementation/author b/tests/data/node/release/re/release/author index 7f776df..7f776df 100644 --- a/tests/data/node/implementation/im/implementation/author +++ b/tests/data/node/release/re/release/author diff --git a/tests/data/node/implementation/im/implementation/context b/tests/data/node/release/re/release/context index a91a902..a91a902 100644 --- a/tests/data/node/implementation/im/implementation/context +++ b/tests/data/node/release/re/release/context diff --git a/tests/data/node/implementation/im/implementation/ctime b/tests/data/node/release/re/release/ctime index 7e9db3f..7e9db3f 100644 --- a/tests/data/node/implementation/im/implementation/ctime +++ b/tests/data/node/release/re/release/ctime diff --git a/tests/data/node/implementation/im/implementation/data b/tests/data/node/release/re/release/data index 8827a89..8827a89 100644 --- a/tests/data/node/implementation/im/implementation/data +++ b/tests/data/node/release/re/release/data diff --git a/tests/data/node/implementation/im/implementation/data.blob b/tests/data/node/release/re/release/data.blob Binary files differindex 5960bb7..5960bb7 100644 --- a/tests/data/node/implementation/im/implementation/data.blob +++ b/tests/data/node/release/re/release/data.blob diff --git a/tests/data/node/implementation/im/implementation/date b/tests/data/node/release/re/release/date index c19d59f..c19d59f 100644 --- a/tests/data/node/implementation/im/implementation/date +++ b/tests/data/node/release/re/release/date diff --git a/tests/data/node/release/re/release/guid b/tests/data/node/release/re/release/guid new file mode 100644 index 0000000..fec2ade --- /dev/null +++ b/tests/data/node/release/re/release/guid @@ -0,0 +1 @@ +{"seqno": 3, "value": "release"}
\ No newline at end of file diff --git a/tests/data/node/implementation/im/implementation/layer b/tests/data/node/release/re/release/layer index 1fe70e4..1fe70e4 100644 --- a/tests/data/node/implementation/im/implementation/layer +++ b/tests/data/node/release/re/release/layer diff --git a/tests/data/node/implementation/im/implementation/license b/tests/data/node/release/re/release/license index 8bce558..8bce558 100644 --- a/tests/data/node/implementation/im/implementation/license +++ b/tests/data/node/release/re/release/license diff --git a/tests/data/node/implementation/im/implementation/mtime b/tests/data/node/release/re/release/mtime index 02fc45e..02fc45e 100644 --- a/tests/data/node/implementation/im/implementation/mtime +++ b/tests/data/node/release/re/release/mtime diff --git a/tests/data/node/implementation/im/implementation/notes b/tests/data/node/release/re/release/notes index fc57242..fc57242 100644 --- a/tests/data/node/implementation/im/implementation/notes +++ b/tests/data/node/release/re/release/notes diff --git a/tests/data/node/implementation/im/implementation/requires b/tests/data/node/release/re/release/requires index 80876de..80876de 100644 --- a/tests/data/node/implementation/im/implementation/requires +++ b/tests/data/node/release/re/release/requires diff --git a/tests/data/node/implementation/im/implementation/seqno b/tests/data/node/release/re/release/seqno index aed8146..aed8146 100644 --- a/tests/data/node/implementation/im/implementation/seqno +++ b/tests/data/node/release/re/release/seqno diff --git a/tests/data/node/implementation/im/implementation/stability b/tests/data/node/release/re/release/stability index 605110e..605110e 100644 --- a/tests/data/node/implementation/im/implementation/stability +++ b/tests/data/node/release/re/release/stability diff --git a/tests/data/node/implementation/im/implementation/tags b/tests/data/node/release/re/release/tags index 80876de..80876de 100644 --- a/tests/data/node/implementation/im/implementation/tags +++ b/tests/data/node/release/re/release/tags diff --git a/tests/data/node/implementation/im/implementation/user b/tests/data/node/release/re/release/user index faa7982..faa7982 100644 --- a/tests/data/node/implementation/im/implementation/user +++ b/tests/data/node/release/re/release/user diff --git a/tests/data/node/implementation/im/implementation/version b/tests/data/node/release/re/release/version index b39d096..b39d096 100644 --- a/tests/data/node/implementation/im/implementation/version +++ b/tests/data/node/release/re/release/version diff --git a/tests/data/node/implementation/im/implementation2/author b/tests/data/node/release/re/release2/author index 7f776df..7f776df 100644 --- a/tests/data/node/implementation/im/implementation2/author +++ b/tests/data/node/release/re/release2/author diff --git a/tests/data/node/implementation/im/implementation2/context b/tests/data/node/release/re/release2/context index 842bf32..842bf32 100644 --- a/tests/data/node/implementation/im/implementation2/context +++ b/tests/data/node/release/re/release2/context diff --git a/tests/data/node/implementation/im/implementation2/ctime b/tests/data/node/release/re/release2/ctime index 7e9db3f..7e9db3f 100644 --- a/tests/data/node/implementation/im/implementation2/ctime +++ b/tests/data/node/release/re/release2/ctime diff --git a/tests/data/node/implementation/im/implementation2/data b/tests/data/node/release/re/release2/data index c11bbb8..c11bbb8 100644 --- a/tests/data/node/implementation/im/implementation2/data +++ b/tests/data/node/release/re/release2/data diff --git a/tests/data/node/implementation/im/implementation2/data.blob b/tests/data/node/release/re/release2/data.blob Binary files differindex 5960bb7..5960bb7 100644 --- a/tests/data/node/implementation/im/implementation2/data.blob +++ b/tests/data/node/release/re/release2/data.blob diff --git a/tests/data/node/implementation/im/implementation2/date b/tests/data/node/release/re/release2/date index c19d59f..c19d59f 100644 --- a/tests/data/node/implementation/im/implementation2/date +++ b/tests/data/node/release/re/release2/date diff --git a/tests/data/node/release/re/release2/guid b/tests/data/node/release/re/release2/guid new file mode 100644 index 0000000..ac30b3e --- /dev/null +++ b/tests/data/node/release/re/release2/guid @@ -0,0 +1 @@ +{"seqno": 3, "value": "release2"}
\ No newline at end of file diff --git a/tests/data/node/implementation/im/implementation2/layer b/tests/data/node/release/re/release2/layer index 1fe70e4..1fe70e4 100644 --- a/tests/data/node/implementation/im/implementation2/layer +++ b/tests/data/node/release/re/release2/layer diff --git a/tests/data/node/implementation/im/implementation2/license b/tests/data/node/release/re/release2/license index 8bce558..8bce558 100644 --- a/tests/data/node/implementation/im/implementation2/license +++ b/tests/data/node/release/re/release2/license diff --git a/tests/data/node/implementation/im/implementation2/mtime b/tests/data/node/release/re/release2/mtime index 02fc45e..02fc45e 100644 --- a/tests/data/node/implementation/im/implementation2/mtime +++ b/tests/data/node/release/re/release2/mtime diff --git a/tests/data/node/implementation/im/implementation2/notes b/tests/data/node/release/re/release2/notes index fc57242..fc57242 100644 --- a/tests/data/node/implementation/im/implementation2/notes +++ b/tests/data/node/release/re/release2/notes diff --git a/tests/data/node/implementation/im/implementation2/requires b/tests/data/node/release/re/release2/requires index 80876de..80876de 100644 --- a/tests/data/node/implementation/im/implementation2/requires +++ b/tests/data/node/release/re/release2/requires diff --git a/tests/data/node/implementation/im/implementation2/seqno b/tests/data/node/release/re/release2/seqno index aed8146..aed8146 100644 --- a/tests/data/node/implementation/im/implementation2/seqno +++ b/tests/data/node/release/re/release2/seqno diff --git a/tests/data/node/implementation/im/implementation2/stability b/tests/data/node/release/re/release2/stability index 605110e..605110e 100644 --- a/tests/data/node/implementation/im/implementation2/stability +++ b/tests/data/node/release/re/release2/stability diff --git a/tests/data/node/implementation/im/implementation2/tags b/tests/data/node/release/re/release2/tags index 80876de..80876de 100644 --- a/tests/data/node/implementation/im/implementation2/tags +++ b/tests/data/node/release/re/release2/tags diff --git a/tests/data/node/implementation/im/implementation2/user b/tests/data/node/release/re/release2/user index faa7982..faa7982 100644 --- a/tests/data/node/implementation/im/implementation2/user +++ b/tests/data/node/release/re/release2/user diff --git a/tests/data/node/implementation/im/implementation2/version b/tests/data/node/release/re/release2/version index b39d096..b39d096 100644 --- a/tests/data/node/implementation/im/implementation2/version +++ b/tests/data/node/release/re/release2/version diff --git a/tests/integration/node_client.py b/tests/integration/node_client.py index c4de2fb..601e969 100755 --- a/tests/integration/node_client.py +++ b/tests/integration/node_client.py @@ -69,9 +69,9 @@ class NodeClientTest(tests.Test): {'guid': impl1, 'version': '1', 'stability': 'developer', 'license': ['Public Domain']}, {'guid': impl2, 'version': '2', 'stability': 'stable', 'license': ['Public Domain']}, ], - self.cli(['GET', '/implementation', 'context=activity2', 'reply=guid,version,stability,license', 'order_by=version'])['result']) - assert blob1 == file('node/implementation/%s/%s/data.blob' % (impl1[:2], impl1)).read() - assert blob2 == file('node/implementation/%s/%s/data.blob' % (impl2[:2], impl2)).read() + self.cli(['GET', '/release', 'context=activity2', 'reply=guid,version,stability,license', 'order_by=version'])['result']) + assert blob1 == file('node/release/%s/%s/data.blob' % (impl1[:2], impl1)).read() + assert blob2 == file('node/release/%s/%s/data.blob' % (impl2[:2], impl2)).read() def test_ReleaseContext(self): context = self.cli(['POST', '/context'], stdin={ @@ -105,9 +105,9 @@ class NodeClientTest(tests.Test): {'guid': impl1, 'version': '1', 'stability': 'developer', 'license': ['GPLv3+']}, {'guid': impl2, 'version': '2', 'stability': 'stable', 'license': ['GPLv3+']}, ], - self.cli(['GET', '/implementation', 'context=%s' % context, 'reply=guid,version,stability,license', 'order_by=version'])['result']) - assert blob1 == file('node/implementation/%s/%s/data.blob' % (impl1[:2], impl1)).read() - assert blob2 == file('node/implementation/%s/%s/data.blob' % (impl2[:2], impl2)).read() + self.cli(['GET', '/release', 'context=%s' % context, 'reply=guid,version,stability,license', 'order_by=version'])['result']) + assert blob1 == file('node/release/%s/%s/data.blob' % (impl1[:2], impl1)).read() + assert blob2 == file('node/release/%s/%s/data.blob' % (impl2[:2], impl2)).read() def test_CloneContext(self): activity_info = '\n'.join([ @@ -126,11 +126,11 @@ class NodeClientTest(tests.Test): self.cli(['PUT', '/context/bundle_id', 'cmd=clone', '-jd1']) self.assertEqual( activity_info, - file('client/db/implementation/%s/%s/data.blob/activity/activity.info' % (impl[:2], impl)).read()) + file('client/db/release/%s/%s/data.blob/activity/activity.info' % (impl[:2], impl)).read()) def test_UsecaseOOB(self): self.cli(['--quiet', 'PUT', '/context/context', 'cmd=clone', '-jd', 'true']) - assert exists('client/db/implementation/im/implementation/data.blob/activity/activity.info') + assert exists('client/db/release/im/release/data.blob/activity/activity.info') self.assertEqual(['clone'], json.load(file('client/db/context/co/context/layer'))['value']) def cli(self, cmd, stdin=None): diff --git a/tests/regression/api.py b/tests/regression/api.py index c5bcc4e..ce89952 100755 --- a/tests/regression/api.py +++ b/tests/regression/api.py @@ -26,7 +26,7 @@ class Api(tests.Test): self.start_online_client() ipc = client.IPCConnection() - ipc.upload(['implementation'], StringIO( + ipc.upload(['release'], StringIO( self.zips( ['activity1.activity/activity/activity.info', [ '[Activity]', @@ -43,7 +43,7 @@ class Api(tests.Test): ]], )), cmd='submit', initial=True) - ipc.upload(['implementation'], StringIO( + ipc.upload(['release'], StringIO( self.zips( ['activity1.activity/activity/activity.info', [ '[Activity]', @@ -61,7 +61,7 @@ class Api(tests.Test): )), cmd='submit') - ipc.upload(['implementation'], StringIO( + ipc.upload(['release'], StringIO( self.zips( ['activity2.activity/activity/activity.info', [ '[Activity]', @@ -78,7 +78,7 @@ class Api(tests.Test): ]], )), cmd='submit', initial=True) - ipc.upload(['implementation'], StringIO( + ipc.upload(['release'], StringIO( self.zips( ['activity2.activity/activity/activity.info', [ '[Activity]', 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': {}}}}}}, diff --git a/tests/units/model/__main__.py b/tests/units/model/__main__.py index 6d8e563..6cc5c7f 100644 --- a/tests/units/model/__main__.py +++ b/tests/units/model/__main__.py @@ -4,7 +4,7 @@ from __init__ import tests from comment import * from context import * -from implementation import * +from release import * from review import * from solution import * from routes import * diff --git a/tests/units/model/comment.py b/tests/units/model/comment.py index 048a6a4..495e6cb 100755 --- a/tests/units/model/comment.py +++ b/tests/units/model/comment.py @@ -10,14 +10,14 @@ from sugar_network.model.review import Review from sugar_network.model.feedback import Feedback from sugar_network.model.solution import Solution from sugar_network.model.comment import Comment -from sugar_network.model.implementation import Implementation +from sugar_network.model.release import Release from sugar_network.toolkit import http class CommentTest(tests.Test): def test_SetContext(self): - volume = self.start_master([User, Context, Review, Feedback, Solution, Comment, Implementation]) + volume = self.start_master([User, Context, Review, Feedback, Solution, Comment, Release]) client = Connection(auth=http.SugarAuth(keyfile.value)) self.assertRaises(http.NotFound, client.post, ['comment'], {'message': '', 'review': 'absent'}) diff --git a/tests/units/model/implementation.py b/tests/units/model/release.py index 070df70..2f4bfb1 100755 --- a/tests/units/model/implementation.py +++ b/tests/units/model/release.py @@ -8,13 +8,13 @@ import xapian from __init__ import tests from sugar_network import db -from sugar_network.model import implementation -from sugar_network.model.implementation import _fmt_version, Implementation +from sugar_network.model import release +from sugar_network.model.release import _fmt_version, Release from sugar_network.client import IPCConnection from sugar_network.toolkit import http, coroutine -class ImplementationTest(tests.Test): +class ReleaseTest(tests.Test): def test_fmt_version(self): self.assertEqual( @@ -77,16 +77,16 @@ class ImplementationTest(tests.Test): 'author': {'fake': None}, }) - guid = client.post(['implementation'], { + guid = client.post(['release'], { 'context': 'context', 'license': 'GPLv3+', 'version': '1', 'stability': 'stable', 'notes': '', }) - self.assertEqual([], self.node_volume['implementation'].get(guid)['layer']) + self.assertEqual([], self.node_volume['release'].get(guid)['layer']) - guid = client.post(['implementation'], { + guid = client.post(['release'], { 'context': 'context', 'license': 'GPLv3+', 'version': '1', @@ -94,20 +94,20 @@ class ImplementationTest(tests.Test): 'notes': '', 'layer': ['foo'], }) - self.assertEqual(['foo'], self.node_volume['implementation'].get(guid)['layer']) + self.assertEqual(['foo'], self.node_volume['release'].get(guid)['layer']) self.node_volume['context'].update('context', {'author': {tests.UID: None}}) - guid = client.post(['implementation'], { + guid = client.post(['release'], { 'context': 'context', 'license': 'GPLv3+', 'version': '1', 'stability': 'stable', 'notes': '', }) - self.assertEqual(['origin'], self.node_volume['implementation'].get(guid)['layer']) + self.assertEqual(['origin'], self.node_volume['release'].get(guid)['layer']) - guid = client.post(['implementation'], { + guid = client.post(['release'], { 'context': 'context', 'license': 'GPLv3+', 'version': '1', @@ -117,7 +117,7 @@ class ImplementationTest(tests.Test): }) self.assertEqual( sorted(['foo', 'origin']), - sorted(self.node_volume['implementation'].get(guid)['layer'])) + sorted(self.node_volume['release'].get(guid)['layer'])) if __name__ == '__main__': diff --git a/tests/units/model/review.py b/tests/units/model/review.py index 52ee54a..10277ac 100755 --- a/tests/units/model/review.py +++ b/tests/units/model/review.py @@ -8,14 +8,14 @@ from sugar_network.model.user import User from sugar_network.model.context import Context from sugar_network.model.review import Review from sugar_network.model.artifact import Artifact -from sugar_network.model.implementation import Implementation +from sugar_network.model.release import Release from sugar_network.toolkit import http class ReviewTest(tests.Test): def test_SetContext(self): - volume = self.start_master([User, Context, Review, Artifact, Implementation]) + volume = self.start_master([User, Context, Review, Artifact, Release]) client = Connection(auth=http.SugarAuth(keyfile.value)) context = client.post(['context'], { diff --git a/tests/units/model/routes.py b/tests/units/model/routes.py index f47ed88..989dfc1 100755 --- a/tests/units/model/routes.py +++ b/tests/units/model/routes.py @@ -93,8 +93,8 @@ class RoutesTest(tests.Test): 'description': '', 'dependencies': ['foo', 'bar'], }) - volume['implementation'].create({ - 'guid': 'implementation', + volume['release'].create({ + 'guid': 'release', 'context': 'context', 'license': 'GPLv3', 'version': '1', @@ -112,9 +112,9 @@ class RoutesTest(tests.Test): }) self.assertEqual({ - 'implementations': [ + 'releases': [ { - 'guid': 'implementation', + 'guid': 'release', 'author': {}, 'ctime': 0, 'data': { diff --git a/tests/units/model/solution.py b/tests/units/model/solution.py index f550d97..d4c7444 100755 --- a/tests/units/model/solution.py +++ b/tests/units/model/solution.py @@ -8,14 +8,14 @@ from sugar_network.model.user import User from sugar_network.model.context import Context from sugar_network.model.feedback import Feedback from sugar_network.model.solution import Solution -from sugar_network.model.implementation import Implementation +from sugar_network.model.release import Release from sugar_network.toolkit import http class SolutionTest(tests.Test): def test_SetContext(self): - volume = self.start_master([User, Context, Feedback, Solution, Implementation]) + volume = self.start_master([User, Context, Feedback, Solution, Release]) client = Connection(auth=http.SugarAuth(keyfile.value)) context = client.post(['context'], { diff --git a/tests/units/node/master.py b/tests/units/node/master.py index bae7d39..b3eaa75 100755 --- a/tests/units/node/master.py +++ b/tests/units/node/master.py @@ -153,7 +153,7 @@ class MasterTest(tests.Test): events = [] def read_events(): for event in ipc.subscribe(): - if event.get('resource') == 'implementation': + if event.get('resource') == 'release': events.append(event) job = coroutine.spawn(read_events) @@ -174,7 +174,7 @@ class MasterTest(tests.Test): }) coroutine.sleep(.5) self.assertEqual([ - {'event': 'populate', 'resource': 'implementation', 'mtime': int(os.stat('master/implementation/index/mtime').st_mtime)}, + {'event': 'populate', 'resource': 'release', 'mtime': int(os.stat('master/release/index/mtime').st_mtime)}, ], events) self.assertEqual({ @@ -189,7 +189,7 @@ class MasterTest(tests.Test): events = [] def read_events(): for event in ipc.subscribe(): - if event.get('resource') == 'implementation': + if event.get('resource') == 'release': events.append(event) job = coroutine.spawn(read_events) @@ -205,7 +205,7 @@ class MasterTest(tests.Test): ipc.put(['context', guid, 'dependencies'], ['foo']) coroutine.sleep(.1) self.assertEqual([ - {'event': 'populate', 'resource': 'implementation', 'mtime': int(os.stat('master/implementation/index/mtime').st_mtime)}, + {'event': 'populate', 'resource': 'release', 'mtime': int(os.stat('master/release/index/mtime').st_mtime)}, ], events) diff --git a/tests/units/node/node.py b/tests/units/node/node.py index f97df3a..1e8b093 100755 --- a/tests/units/node/node.py +++ b/tests/units/node/node.py @@ -24,7 +24,7 @@ from sugar_network.node.routes import NodeRoutes, generate_node_stats from sugar_network.node.master import MasterRoutes 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.model.review import Review from sugar_network.model.feedback import Feedback from sugar_network.model.artifact import Artifact @@ -578,7 +578,7 @@ class NodeTest(tests.Test): 'summary': 'summary', 'description': 'description', }) - impl1 = client.post(['implementation'], { + impl1 = client.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '1', @@ -586,7 +586,7 @@ class NodeTest(tests.Test): 'notes': '', }) blob1 = self.zips(('topdir/probe', 'probe1')) - volume['implementation'].update(impl1, {'data': { + volume['release'].update(impl1, {'data': { 'blob': StringIO(blob1), 'spec': { '*-*': { @@ -596,7 +596,7 @@ class NodeTest(tests.Test): }, }, }}) - impl2 = client.post(['implementation'], { + impl2 = client.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '2', @@ -604,7 +604,7 @@ class NodeTest(tests.Test): 'notes': '', }) blob2 = self.zips(('topdir/probe', 'probe2')) - volume['implementation'].update(impl2, {'data': { + volume['release'].update(impl2, {'data': { 'blob': StringIO(blob2), 'spec': { '*-*': { @@ -615,7 +615,7 @@ class NodeTest(tests.Test): }, }, }}) - impl3 = client.post(['implementation'], { + impl3 = client.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '3', @@ -623,7 +623,7 @@ class NodeTest(tests.Test): 'notes': '', }) blob3 = self.zips(('topdir/probe', 'probe3')) - volume['implementation'].update(impl3, {'data': { + volume['release'].update(impl3, {'data': { 'blob': StringIO(blob3), 'spec': { '*-*': { @@ -633,7 +633,7 @@ class NodeTest(tests.Test): }, }, }}) - impl4 = client.post(['implementation'], { + impl4 = client.post(['release'], { 'context': context, 'license': 'GPLv3+', 'version': '4', @@ -641,7 +641,7 @@ class NodeTest(tests.Test): 'notes': '', }) blob4 = self.zips(('topdir/probe', 'probe4')) - volume['implementation'].update(impl4, {'data': { + volume['release'].update(impl4, {'data': { 'blob': StringIO(blob4), 'spec': { '*-*': { @@ -673,7 +673,7 @@ class NodeTest(tests.Test): 'license': ['GPLv3+'], 'layer': ['origin'], 'author': {tests.UID: {'name': tests.UID, 'order': 0, 'role': 3}}, - 'ctime': self.node_volume['implementation'].get(impl3).ctime, + 'ctime': self.node_volume['release'].get(impl3).ctime, 'notes': {'en-us': ''}, 'tags': [], 'data': { @@ -718,9 +718,9 @@ class NodeTest(tests.Test): ('topdir/activity/activity.info', activity_info), ('topdir/CHANGELOG', changelog), ) - guid1 = json.load(conn.request('POST', ['implementation'], bundle1, params={'cmd': 'submit'}).raw) + guid1 = json.load(conn.request('POST', ['release'], bundle1, params={'cmd': 'submit'}).raw) - impl = volume['implementation'].get(guid1) + impl = volume['release'].get(guid1) self.assertEqual('bundle_id', impl['context']) self.assertEqual('1', impl['version']) self.assertEqual('developer', impl['stability']) @@ -756,12 +756,12 @@ class NodeTest(tests.Test): 'stability = stable', ]) bundle2 = self.zips(('topdir/activity/activity.info', activity_info)) - guid2 = json.load(conn.request('POST', ['implementation'], bundle2, params={'cmd': 'submit'}).raw) + guid2 = json.load(conn.request('POST', ['release'], bundle2, params={'cmd': 'submit'}).raw) - self.assertEqual('1', volume['implementation'].get(guid1)['version']) - self.assertEqual(['origin'], volume['implementation'].get(guid1)['layer']) - self.assertEqual('2', volume['implementation'].get(guid2)['version']) - self.assertEqual(['origin'], volume['implementation'].get(guid2)['layer']) + self.assertEqual('1', volume['release'].get(guid1)['version']) + self.assertEqual(['origin'], volume['release'].get(guid1)['layer']) + self.assertEqual('2', volume['release'].get(guid2)['version']) + self.assertEqual(['origin'], volume['release'].get(guid2)['layer']) self.assertEqual(bundle2, conn.get(['context', 'bundle_id'], cmd='clone')) activity_info = '\n'.join([ @@ -775,14 +775,14 @@ class NodeTest(tests.Test): 'stability = stable', ]) bundle3 = self.zips(('topdir/activity/activity.info', activity_info)) - guid3 = json.load(conn.request('POST', ['implementation'], bundle3, params={'cmd': 'submit'}).raw) - - self.assertEqual('1', volume['implementation'].get(guid1)['version']) - self.assertEqual(sorted(['origin', 'deleted']), sorted(volume['implementation'].get(guid1)['layer'])) - self.assertEqual('2', volume['implementation'].get(guid2)['version']) - self.assertEqual(['origin'], volume['implementation'].get(guid2)['layer']) - self.assertEqual('1', volume['implementation'].get(guid3)['version']) - self.assertEqual(['origin'], volume['implementation'].get(guid3)['layer']) + guid3 = json.load(conn.request('POST', ['release'], bundle3, params={'cmd': 'submit'}).raw) + + self.assertEqual('1', volume['release'].get(guid1)['version']) + self.assertEqual(sorted(['origin', 'deleted']), sorted(volume['release'].get(guid1)['layer'])) + self.assertEqual('2', volume['release'].get(guid2)['version']) + self.assertEqual(['origin'], volume['release'].get(guid2)['layer']) + self.assertEqual('1', volume['release'].get(guid3)['version']) + self.assertEqual(['origin'], volume['release'].get(guid3)['layer']) self.assertEqual(bundle2, conn.get(['context', 'bundle_id'], cmd='clone')) activity_info = '\n'.join([ @@ -796,16 +796,16 @@ class NodeTest(tests.Test): 'stability = buggy', ]) bundle4 = self.zips(('topdir/activity/activity.info', activity_info)) - guid4 = json.load(conn.request('POST', ['implementation'], bundle4, params={'cmd': 'submit'}).raw) - - self.assertEqual('1', volume['implementation'].get(guid1)['version']) - self.assertEqual(sorted(['origin', 'deleted']), sorted(volume['implementation'].get(guid1)['layer'])) - self.assertEqual('2', volume['implementation'].get(guid2)['version']) - self.assertEqual(sorted(['origin', 'deleted']), sorted(volume['implementation'].get(guid2)['layer'])) - self.assertEqual('1', volume['implementation'].get(guid3)['version']) - self.assertEqual(['origin'], volume['implementation'].get(guid3)['layer']) - self.assertEqual('2', volume['implementation'].get(guid4)['version']) - self.assertEqual(['origin'], volume['implementation'].get(guid4)['layer']) + guid4 = json.load(conn.request('POST', ['release'], bundle4, params={'cmd': 'submit'}).raw) + + self.assertEqual('1', volume['release'].get(guid1)['version']) + self.assertEqual(sorted(['origin', 'deleted']), sorted(volume['release'].get(guid1)['layer'])) + self.assertEqual('2', volume['release'].get(guid2)['version']) + self.assertEqual(sorted(['origin', 'deleted']), sorted(volume['release'].get(guid2)['layer'])) + self.assertEqual('1', volume['release'].get(guid3)['version']) + self.assertEqual(['origin'], volume['release'].get(guid3)['layer']) + self.assertEqual('2', volume['release'].get(guid4)['version']) + self.assertEqual(['origin'], volume['release'].get(guid4)['layer']) self.assertEqual(bundle3, conn.get(['context', 'bundle_id'], cmd='clone')) def test_release_UpdateContext(self): @@ -855,7 +855,7 @@ class NodeTest(tests.Test): base64.b64decode('3hIElQAAAAAMAAAAHAAAAHwAAAARAAAA3AAAAAAAAAAgAQAADwAAACEBAAAOAAAAMQEAAA0AAABAAQAACgAAAE4BAAAMAAAAWQEAAA0AAABmAQAAJwAAAHQBAAAUAAAAnAEAABAAAACxAQAABwAAAMIBAAAIAAAAygEAANEBAADTAQAAIQAAAKUDAAATAAAAxwMAABwAAADbAwAAFwAAAPgDAAAhAAAAEAQAAB0AAAAyBAAAQAAAAFAEAAA9AAAAkQQAADUAAADPBAAAFAAAAAUFAAAQAAAAGgUAAAEAAAACAAAABwAAAAAAAAADAAAAAAAAAAwAAAAJAAAAAAAAAAoAAAAEAAAAAAAAAAAAAAALAAAABgAAAAgAAAAFAAAAAENob29zZSBkb2N1bWVudABEb3dubG9hZGluZy4uLgBGaXQgdG8gd2luZG93AEZ1bGxzY3JlZW4ASW1hZ2UgVmlld2VyAE9yaWdpbmFsIHNpemUAUmV0cmlldmluZyBzaGFyZWQgaW1hZ2UsIHBsZWFzZSB3YWl0Li4uAFJvdGF0ZSBhbnRpY2xvY2t3aXNlAFJvdGF0ZSBjbG9ja3dpc2UAWm9vbSBpbgBab29tIG91dABQcm9qZWN0LUlkLVZlcnNpb246IFBBQ0tBR0UgVkVSU0lPTgpSZXBvcnQtTXNnaWQtQnVncy1UbzogClBPVC1DcmVhdGlvbi1EYXRlOiAyMDEyLTA5LTI3IDE0OjU3LTA0MDAKUE8tUmV2aXNpb24tRGF0ZTogMjAxMC0wOS0yMiAxMzo1MCswMjAwCkxhc3QtVHJhbnNsYXRvcjoga3JvbTlyYSA8a3JvbTlyYUBnbWFpbC5jb20+Ckxhbmd1YWdlLVRlYW06IExBTkdVQUdFIDxMTEBsaS5vcmc+Ckxhbmd1YWdlOiAKTUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PVVURi04CkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IDhiaXQKUGx1cmFsLUZvcm1zOiBucGx1cmFscz0zOyBwbHVyYWw9KG4lMTA9PTEgJiYgbiUxMDAhPTExID8gMCA6IG4lMTA+PTIgJiYgbiUxMDw9NCAmJiAobiUxMDA8MTAgfHwgbiUxMDA+PTIwKSA/IDEgOiAyKTsKWC1HZW5lcmF0b3I6IFBvb3RsZSAyLjAuMwoA0JLRi9Cx0LXRgNC40YLQtSDQtNC+0LrRg9C80LXQvdGCANCX0LDQs9GA0YPQt9C60LAuLi4A0KPQvNC10YHRgtC40YLRjCDQsiDQvtC60L3QtQDQn9C+0LvQvdGL0Lkg0Y3QutGA0LDQvQDQn9GA0L7RgdC80L7RgtGAINC60LDRgNGC0LjQvdC+0LoA0JjRgdGC0LjQvdC90YvQuSDRgNCw0LfQvNC10YAA0J/QvtC70YPRh9C10L3QuNC1INC40LfQvtCx0YDQsNC20LXQvdC40LksINC/0L7QtNC+0LbQtNC40YLQtS4uLgDQn9C+0LLQtdGA0L3Rg9GC0Ywg0L/RgNC+0YLQuNCyINGH0LDRgdC+0LLQvtC5INGB0YLRgNC10LvQutC4ANCf0L7QstC10YDQvdGD0YLRjCDQv9C+INGH0LDRgdC+0LLQvtC5INGB0YLRgNC10LvQutC1ANCf0YDQuNCx0LvQuNC30LjRgtGMANCe0YLQtNCw0LvQuNGC0YwA')), ('ImageViewer.activity/activity/activity-imageviewer.svg', svg), ) - impl = json.load(conn.request('POST', ['implementation'], bundle, params={'cmd': 'submit'}).raw) + impl = json.load(conn.request('POST', ['release'], bundle, params={'cmd': 'submit'}).raw) context = volume['context'].get('org.laptop.ImageViewerActivity') self.assertEqual({ @@ -897,8 +897,8 @@ class NodeTest(tests.Test): ])), ('ImageViewer.activity/activity/activity-imageviewer.svg', ''), ) - self.assertRaises(http.NotFound, conn.request, 'POST', ['implementation'], bundle, params={'cmd': 'submit'}) - impl = json.load(conn.request('POST', ['implementation'], bundle, params={'cmd': 'submit', 'initial': 1}).raw) + self.assertRaises(http.NotFound, conn.request, 'POST', ['release'], bundle, params={'cmd': 'submit'}) + impl = json.load(conn.request('POST', ['release'], bundle, params={'cmd': 'submit', 'initial': 1}).raw) context = volume['context'].get('org.laptop.ImageViewerActivity') self.assertEqual({'en': 'Image Viewer'}, context['title']) @@ -926,17 +926,17 @@ class NodeTest(tests.Test): ) conn = Connection(auth=http.SugarAuth(join(tests.root, 'data', tests.UID))) - impl1 = json.load(conn.request('POST', ['implementation'], bundle, params={'cmd': 'submit', 'initial': 1}).raw) - impl2 = json.load(conn.request('POST', ['implementation'], bundle, params={'cmd': 'submit'}).raw) - self.assertEqual(sorted(['origin', 'deleted']), sorted(volume['implementation'].get(impl1)['layer'])) - self.assertEqual(['origin'], volume['implementation'].get(impl2)['layer']) + impl1 = json.load(conn.request('POST', ['release'], bundle, params={'cmd': 'submit', 'initial': 1}).raw) + impl2 = json.load(conn.request('POST', ['release'], bundle, params={'cmd': 'submit'}).raw) + self.assertEqual(sorted(['origin', 'deleted']), sorted(volume['release'].get(impl1)['layer'])) + self.assertEqual(['origin'], volume['release'].get(impl2)['layer']) conn = Connection(auth=http.SugarAuth(join(tests.root, 'data', tests.UID2))) conn.get(cmd='whoami') - impl3 = json.load(conn.request('POST', ['implementation'], bundle, params={'cmd': 'submit'}).raw) - self.assertEqual(sorted(['origin', 'deleted']), sorted(volume['implementation'].get(impl1)['layer'])) - self.assertEqual(sorted(['origin', 'deleted']), sorted(volume['implementation'].get(impl2)['layer'])) - self.assertEqual([], volume['implementation'].get(impl3)['layer']) + impl3 = json.load(conn.request('POST', ['release'], bundle, params={'cmd': 'submit'}).raw) + self.assertEqual(sorted(['origin', 'deleted']), sorted(volume['release'].get(impl1)['layer'])) + self.assertEqual(sorted(['origin', 'deleted']), sorted(volume['release'].get(impl2)['layer'])) + self.assertEqual([], volume['release'].get(impl3)['layer']) def test_release_PopulateRequires(self): volume = self.start_master() @@ -955,8 +955,8 @@ class NodeTest(tests.Test): ])), ('ImageViewer.activity/activity/activity-imageviewer.svg', ''), ) - self.assertRaises(http.NotFound, conn.request, 'POST', ['implementation'], bundle, params={'cmd': 'submit'}) - impl = json.load(conn.request('POST', ['implementation'], bundle, params={'cmd': 'submit', 'initial': 1}).raw) + self.assertRaises(http.NotFound, conn.request, 'POST', ['release'], bundle, params={'cmd': 'submit'}) + impl = json.load(conn.request('POST', ['release'], bundle, params={'cmd': 'submit', 'initial': 1}).raw) self.assertEqual( sorted([ @@ -964,7 +964,7 @@ class NodeTest(tests.Test): 'dep6-6', 'dep7-1', 'dep7-2', 'dep7-3', ]), - sorted(volume['implementation'].get(impl)['requires'])) + sorted(volume['release'].get(impl)['requires'])) def test_generate_node_stats_Posts(self): node.stats_root.value = 'stats' @@ -991,7 +991,7 @@ class NodeTest(tests.Test): 'summary': '', 'description': '', }) - volume['implementation'].create({ + volume['release'].create({ 'guid': 'impl_1', 'ctime': ts + 2, 'mtime': ts + 2, @@ -1083,7 +1083,7 @@ class NodeTest(tests.Test): 'mtime': ts + 8, 'layer': [], 'context': 'context_1', - 'implementation': 'impl_1', + 'release': 'impl_1', 'error': '', }) @@ -1104,7 +1104,7 @@ class NodeTest(tests.Test): 'summary': '', 'description': '', }) - volume['implementation'].create({ + volume['release'].create({ 'guid': 'impl_2', 'ctime': ts + 4, 'mtime': ts + 4, @@ -1113,7 +1113,7 @@ class NodeTest(tests.Test): 'license': ['GPL-3'], 'version': '1', }) - volume['implementation'].create({ + volume['release'].create({ 'guid': 'impl_3', 'ctime': ts + 4, 'mtime': ts + 4, @@ -1148,7 +1148,7 @@ class NodeTest(tests.Test): 'mtime': ts + 4, 'layer': [], 'context': 'context_2', - 'implementation': 'impl_1', + 'release': 'impl_1', 'error': '', }) volume['report'].create({ @@ -1157,7 +1157,7 @@ class NodeTest(tests.Test): 'mtime': ts + 4, 'layer': [], 'context': 'context_2', - 'implementation': 'impl_1', + 'release': 'impl_1', 'error': '', }) volume['artifact'].create({ @@ -1228,14 +1228,14 @@ class NodeTest(tests.Test): self.override(time, 'time', lambda: ts + 9) old_stats = stats_node.Sniffer(volume, 'stats/node') - old_stats.log(Request(method='GET', path=['implementation', 'impl_1', 'data'])) + old_stats.log(Request(method='GET', path=['release', 'impl_1', 'data'])) old_stats.log(Request(method='GET', path=['artifact', 'artifact_1', 'data'])) old_stats.commit(ts + 1) old_stats.commit_objects() old_stats.commit(ts + 2) old_stats.commit(ts + 3) - old_stats.log(Request(method='GET', path=['implementation', 'impl_1', 'data'])) - old_stats.log(Request(method='GET', path=['implementation', 'impl_2', 'data'])) + old_stats.log(Request(method='GET', path=['release', 'impl_1', 'data'])) + old_stats.log(Request(method='GET', path=['release', 'impl_2', 'data'])) old_stats.commit(ts + 4) old_stats.commit_objects() old_stats.commit(ts + 5) @@ -1393,7 +1393,7 @@ class NodeTest(tests.Test): 'summary': '', 'description': '', }) - volume['implementation'].create({ + volume['release'].create({ 'guid': 'impl_1', 'ctime': ts + 1, 'mtime': ts + 2, @@ -1456,7 +1456,7 @@ class NodeTest(tests.Test): 'mtime': ts + 2, 'layer': ['deleted'], 'context': 'context_1', - 'implementation': 'impl_1', + 'release': 'impl_1', 'error': '', }) diff --git a/tests/units/node/stats_node.py b/tests/units/node/stats_node.py index 123d225..22f43da 100755 --- a/tests/units/node/stats_node.py +++ b/tests/units/node/stats_node.py @@ -119,14 +119,14 @@ class StatsTest(tests.Test): volume = db.Volume('local', model.RESOURCES) stats = Sniffer(volume, 'stats/node') volume['context'].create({'guid': 'context', 'type': 'activity', 'title': '', 'summary': '', 'description': ''}) - volume['implementation'].create({'guid': 'implementation', 'context': 'context', 'license': 'GPLv3', 'version': '1', 'date': 0, 'stability': 'stable', 'notes': ''}) + volume['release'].create({'guid': 'release', 'context': 'context', 'license': 'GPLv3', 'version': '1', 'date': 0, 'stability': 'stable', 'notes': ''}) - request = Request(method='GET', path=['implementation', 'implementation', 'fake']) + request = Request(method='GET', path=['release', 'release', 'fake']) request.principal = 'user' stats.log(request) self.assertEqual(0, stats._stats['context']['downloaded']) - request = Request(method='GET', path=['implementation', 'implementation', 'data']) + request = Request(method='GET', path=['release', 'release', 'data']) request.principal = 'user' stats.log(request) self.assertEqual(1, stats._stats['context']['downloaded']) @@ -136,7 +136,7 @@ class StatsTest(tests.Test): stats = Sniffer(volume, 'stats/node') volume['context'].create({'guid': 'context', 'type': 'activity', 'title': '', 'summary': '', 'description': ''}) - request = Request(method='POST', path=['implementation']) + request = Request(method='POST', path=['release']) request.principal = 'user' request.content = {'context': 'context'} stats.log(request) @@ -249,7 +249,7 @@ class StatsTest(tests.Test): volume = db.Volume('local', model.RESOURCES) volume['context'].create({'guid': 'context', 'type': 'activity', 'title': '', 'summary': '', 'description': ''}) - volume['implementation'].create({'guid': 'implementation', 'context': 'context', 'license': 'GPLv3', 'version': '1', 'date': 0, 'stability': 'stable', 'notes': ''}) + volume['release'].create({'guid': 'release', 'context': 'context', 'license': 'GPLv3', 'version': '1', 'date': 0, 'stability': 'stable', 'notes': ''}) volume['artifact'].create({'guid': 'artifact', 'type': 'instance', 'context': 'context', 'title': '', 'description': ''}) self.assertEqual(0, volume['context'].get('context')['downloads']) @@ -257,7 +257,7 @@ class StatsTest(tests.Test): self.assertEqual(0, volume['context'].get('context')['rating']) stats = Sniffer(volume, 'stats/node') - request = Request(method='GET', path=['implementation', 'implementation', 'data']) + request = Request(method='GET', path=['release', 'release', 'data']) request.principal = 'user' stats.log(request) request = Request(method='POST', path=['review']) @@ -283,7 +283,7 @@ class StatsTest(tests.Test): self.assertEqual(5, volume['context'].get('context')['rating']) stats = Sniffer(volume, 'stats/node') - request = Request(method='GET', path=['implementation', 'implementation', 'data']) + request = Request(method='GET', path=['release', 'release', 'data']) request.principal = 'user' stats.log(request) request = Request(method='POST', path=['review']) @@ -347,7 +347,7 @@ class StatsTest(tests.Test): stats_node_step.value = 5 volume = db.Volume('local', model.RESOURCES) volume['context'].create({'guid': 'context', 'type': 'activity', 'title': '', 'summary': '', 'description': ''}) - volume['implementation'].create({'guid': 'impl', 'context': 'context', 'license': 'GPLv3', 'version': '1', 'date': 0, 'stability': 'stable', 'notes': ''}) + volume['release'].create({'guid': 'impl', 'context': 'context', 'license': 'GPLv3', 'version': '1', 'date': 0, 'stability': 'stable', 'notes': ''}) ts = self.ts = 1000000000 self.override(time, 'time', lambda: self.ts) @@ -355,7 +355,7 @@ class StatsTest(tests.Test): stats = Sniffer(volume, 'stats') request = Request(method='POST', path=['context']) stats.log(request) - request = Request(method='GET', path=['implementation', 'impl', 'data'], context='context') + request = Request(method='GET', path=['release', 'impl', 'data'], context='context') stats.log(request) stats.suspend() @@ -384,9 +384,9 @@ class StatsTest(tests.Test): request = Request(method='POST', path=['context']) stats.log(request) - request = Request(method='GET', path=['implementation', 'impl', 'data'], context='context') + request = Request(method='GET', path=['release', 'impl', 'data'], context='context') stats.log(request) - request = Request(method='GET', path=['implementation', 'impl', 'data'], context='context') + request = Request(method='GET', path=['release', 'impl', 'data'], context='context') stats.log(request) stats.suspend() diff --git a/tests/units/node/volume.py b/tests/units/node/volume.py index 7978ef0..fc7df1f 100755 --- a/tests/units/node/volume.py +++ b/tests/units/node/volume.py @@ -434,9 +434,9 @@ class VolumeTest(tests.Test): 'feedback': {'value': 'feedback_1', 'mtime': 1.0}, 'content': {'value': {}, 'mtime': 1.0}, }}, - {'resource': 'implementation'}, - {'guid': 'implementation', 'diff': { - 'guid': {'value': 'implementation', 'mtime': 1.0}, + {'resource': 'release'}, + {'guid': 'release', 'diff': { + 'guid': {'value': 'release', 'mtime': 1.0}, 'ctime': {'value': 1, 'mtime': 1.0}, 'mtime': {'value': 1, 'mtime': 1.0}, 'context': {'value': 'context', 'mtime': 1.0}, @@ -546,8 +546,8 @@ class VolumeTest(tests.Test): {'resource': 'solution'}, {'guid': 'solution_1', 'diff': {'layer': {'value': ['deleted'], 'mtime': 3.0}}}, {'guid': 'solution_2', 'diff': {'layer': {'value': ['deleted'], 'mtime': 3.0}}}, - {'resource': 'implementation'}, - {'guid': 'implementation', 'diff': {'layer': {'value': ['deleted'], 'mtime': 3.0}}}, + {'resource': 'release'}, + {'guid': 'release', 'diff': {'layer': {'value': ['deleted'], 'mtime': 3.0}}}, {'commit': [[3, 3]]}, ] merge(volume, records, stats=stats) @@ -797,21 +797,21 @@ class VolumeTest(tests.Test): class Context(db.Resource): pass - class Implementation(db.Resource): + class release(db.Resource): pass class Review(db.Resource): pass - volume = db.Volume('db', [Context, Implementation, Review]) + volume = db.Volume('db', [Context, release, Review]) volume['context'].create({'guid': '0', 'ctime': 1, 'mtime': 1, 'layer': ['layer0', 'common']}) volume['context'].create({'guid': '1', 'ctime': 1, 'mtime': 1, 'layer': 'layer1'}) - volume['implementation'].create({'guid': '2', 'ctime': 2, 'mtime': 2, 'layer': 'layer2'}) + volume['release'].create({'guid': '2', 'ctime': 2, 'mtime': 2, 'layer': 'layer2'}) volume['review'].create({'guid': '3', 'ctime': 3, 'mtime': 3, 'layer': 'layer3'}) volume['context'].update('0', {'tags': '0'}) volume['context'].update('1', {'tags': '1'}) - volume['implementation'].update('2', {'tags': '2'}) + volume['release'].update('2', {'tags': '2'}) volume['review'].update('3', {'tags': '3'}) self.utime('db', 0) @@ -819,7 +819,7 @@ class VolumeTest(tests.Test): {'resource': 'context'}, {'guid': '0', 'diff': {'tags': {'value': '0', 'mtime': 0}}}, {'guid': '1', 'diff': {'tags': {'value': '1', 'mtime': 0}}}, - {'resource': 'implementation'}, + {'resource': 'release'}, {'guid': '2', 'diff': {'tags': {'value': '2', 'mtime': 0}}}, {'resource': 'review'}, {'guid': '3', 'diff': {'tags': {'value': '3', 'mtime': 0}}}, @@ -831,7 +831,7 @@ class VolumeTest(tests.Test): {'resource': 'context'}, {'guid': '0', 'diff': {'tags': {'value': '0', 'mtime': 0}}}, {'guid': '1', 'diff': {'tags': {'value': '1', 'mtime': 0}}}, - {'resource': 'implementation'}, + {'resource': 'release'}, {'resource': 'review'}, {'guid': '3', 'diff': {'tags': {'value': '3', 'mtime': 0}}}, {'commit': [[5, 8]]}, @@ -841,7 +841,7 @@ class VolumeTest(tests.Test): self.assertEqual(sorted([ {'resource': 'context'}, {'guid': '0', 'diff': {'tags': {'value': '0', 'mtime': 0}}}, - {'resource': 'implementation'}, + {'resource': 'release'}, {'guid': '2', 'diff': {'tags': {'value': '2', 'mtime': 0}}}, {'resource': 'review'}, {'guid': '3', 'diff': {'tags': {'value': '3', 'mtime': 0}}}, @@ -852,7 +852,7 @@ class VolumeTest(tests.Test): self.assertEqual(sorted([ {'resource': 'context'}, {'guid': '0', 'diff': {'tags': {'value': '0', 'mtime': 0}}}, - {'resource': 'implementation'}, + {'resource': 'release'}, {'resource': 'review'}, {'guid': '3', 'diff': {'tags': {'value': '3', 'mtime': 0}}}, {'commit': [[5, 8]]}, |