From 2ca3e5f20ec1ad1c122a098abb174dc737df7c32 Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Thu, 30 Jan 2014 14:08:03 +0000 Subject: Rename Implementation resource to Release --- diff --git a/misc/aslo-patch-versions b/misc/aslo-patch-versions index ec6b464..05880ed 100755 --- a/misc/aslo-patch-versions +++ b/misc/aslo-patch-versions @@ -38,7 +38,7 @@ db.index_flush_timeout.value = 0 volume = db.Volume(data_root.value, model.RESOURCES) volume.populate() -directory = volume['implementation'] +directory = volume['release'] try: items, __ = directory.find() for impl in items: diff --git a/misc/aslo-sync b/misc/aslo-sync index 981fa5c..f736681 100755 --- a/misc/aslo-sync +++ b/misc/aslo-sync @@ -418,7 +418,7 @@ class Application(application.Application): directory.update(guid, {'layer': ['deleted']}) def sync_versions(self, addon_id, bundle_id): - directory = self.volume['implementation'] + directory = self.volume['release'] items, __ = directory.find(context=bundle_id, not_layer='deleted') existing = set([i.guid for i in items]) diff --git a/sugar-network b/sugar-network index 8957f99..cb81d79 100755 --- a/sugar-network +++ b/sugar-network @@ -116,8 +116,8 @@ class Application(application.Application): ipc.get(['context', bundle_id], cmd='launch', **params) @application.command( - 'upload new implementaion for a context; if BUNDLE_PATH points ' - 'not to a .xo bundle, specify all implementaion PROPERTYs for the ' + 'upload new release for a context; if BUNDLE_PATH points ' + 'not to a .xo bundle, specify all release PROPERTYs for the ' 'new release (at least context and version)', args='BUNDLE_PATH [PROPERTY=VALUE]', ) @@ -136,12 +136,12 @@ class Application(application.Application): conn = IPCConnection() else: conn = Connection(client.api_url.value) - guid = conn.upload(['implementation'], path, cmd='submit', **props) + guid = conn.upload(['release'], path, cmd='submit', **props) if porcelain.value: self._print(guid, '\n') else: - self._print('-- Uploaded %s implementaion' % guid, '\n') + self._print('-- Uploaded %s release' % guid, '\n') @application.command( 'send raw API POST request; ' diff --git a/sugar_network/client/cache.py b/sugar_network/client/cache.py index 07daa16..e13ccb6 100644 --- a/sugar_network/client/cache.py +++ b/sugar_network/client/cache.py @@ -77,7 +77,7 @@ class Cache(object): self._pool.__getitem__(guid) return _logger.debug('Checkin %r %d bytes long', guid, size) - mtime = os.stat(self._volume['implementation'].path(guid)).st_mtime + mtime = os.stat(self._volume['release'].path(guid)).st_mtime self._pool[guid] = (size, mtime) self._du += size @@ -109,10 +109,10 @@ class Cache(object): if self._pool is not None: return - _logger.debug('Open implementations pool') + _logger.debug('Open releases pool') pool = [] - impls = self._volume['implementation'] + impls = self._volume['release'] for res in impls.find(not_layer=['local'])[0]: meta = res.meta('data') if not meta or 'blob_size' not in meta: @@ -176,7 +176,7 @@ class Cache(object): _logger.debug('Recycle stale %r to save %s bytes', guid, size) else: _logger.debug('Recycle %r to save %s bytes', guid, size) - self._volume['implementation'].delete(guid) + self._volume['release'].delete(guid) self._du -= size if guid in self._pool: del self._pool[guid] diff --git a/sugar_network/client/implementations.py b/sugar_network/client/releases.py index ca9e89c..98b14b2 100644 --- a/sugar_network/client/implementations.py +++ b/sugar_network/client/releases.py @@ -38,7 +38,7 @@ from sugar_network.toolkit import http, coroutine, enforce _MIMETYPE_DEFAULTS_KEY = '/desktop/sugar/journal/defaults' _MIMETYPE_INVALID_CHARS = re.compile('[^a-zA-Z0-9-_/.]') -_logger = logging.getLogger('implementations') +_logger = logging.getLogger('releases') class Routes(object): @@ -58,7 +58,7 @@ class Routes(object): clone_path = self._volume['context'].path(request.guid, '.clone') enforce(exists(clone_path), http.NotFound) clone_impl = basename(os.readlink(clone_path)) - return self._volume['implementation'].path(clone_impl, 'data') + return self._volume['release'].path(clone_impl, 'data') @route('GET', ['context', None], cmd='launch', arguments={'args': list}, mime_type='text/event-stream') @@ -114,8 +114,7 @@ class Routes(object): yield {'event': 'ready'} else: cloned_impl = basename(os.readlink(cloned_path)) - meta = self._volume['implementation'].get( - cloned_impl).meta('data') + meta = self._volume['release'].get(cloned_impl).meta('data') size = meta.get('unpack_size') or meta['blob_size'] self._cache.checkin(cloned_impl, size) os.unlink(cloned_path) @@ -213,7 +212,7 @@ class Routes(object): def _checkin_impl(self, context, request, cache_call): if 'clone' in context['layer']: cache_call = self._cache.checkout - impls = self._volume['implementation'] + impls = self._volume['release'] if 'activity' in context['type']: to_install = [] @@ -239,8 +238,7 @@ class Routes(object): return cache_call(guid, size) if blob is None: - blob = self._call(method='GET', - path=['implementation', guid, 'data']) + blob = self._call(method='GET', path=['release', guid, 'data']) blob_dir = dirname(sel['path']) if not exists(blob_dir): @@ -318,7 +316,7 @@ class Routes(object): if 'clone' not in context['layer']: return self._map_exceptions(self.fallback, request, response) guid = basename(os.readlink(context.path('.clone'))) - impl = self._volume['implementation'].get(guid) + impl = self._volume['release'].get(guid) response.meta = impl.properties([ 'guid', 'ctime', 'layer', 'author', 'tags', 'context', 'version', 'stability', 'license', 'notes', 'data', diff --git a/sugar_network/client/routes.py b/sugar_network/client/routes.py index e43eea5..c6ea6d2 100644 --- a/sugar_network/client/routes.py +++ b/sugar_network/client/routes.py @@ -21,7 +21,7 @@ from zipfile import ZipFile, ZIP_DEFLATED from os.path import join, basename from sugar_network import db, client, node, toolkit, model -from sugar_network.client import journal, implementations +from sugar_network.client import journal, releases from sugar_network.node.slave import SlaveRoutes from sugar_network.toolkit import netlink, mountpoints from sugar_network.toolkit.router import ACL, Request, Response, Router @@ -40,11 +40,11 @@ _LOCAL_LAYERS = frozenset(['local', 'clone', 'favorite']) _logger = logging.getLogger('client.routes') -class ClientRoutes(model.FrontRoutes, implementations.Routes, journal.Routes): +class ClientRoutes(model.FrontRoutes, releases.Routes, journal.Routes): def __init__(self, home_volume, api_url=None, no_subscription=False): model.FrontRoutes.__init__(self) - implementations.Routes.__init__(self, home_volume) + releases.Routes.__init__(self, home_volume) journal.Routes.__init__(self) self._local = _LocalRoutes(home_volume) @@ -201,7 +201,7 @@ class ClientRoutes(model.FrontRoutes, implementations.Routes, journal.Routes): request.update(kwargs) if self._inline.is_set(): if client.layers.value and \ - request.resource in ('context', 'implementation'): + request.resource in ('context', 'release'): request.add('layer', *client.layers.value) request.principal = self._auth.login try: @@ -262,7 +262,7 @@ class ClientRoutes(model.FrontRoutes, implementations.Routes, journal.Routes): def pull_events(): for event in self._node.subscribe(): - if event.get('resource') == 'implementation': + if event.get('resource') == 'release': mtime = event.get('mtime') if mtime: self.invalidate_solutions(mtime) @@ -273,7 +273,7 @@ class ClientRoutes(model.FrontRoutes, implementations.Routes, journal.Routes): self._node = client.Connection(url, auth=self._auth) status = self._node.get(cmd='status') self._auth.allow_basic_auth = (status.get('level') == 'master') - impl_info = status['resources'].get('implementation') + impl_info = status['resources'].get('release') if impl_info: self.invalidate_solutions(impl_info['mtime']) if self._inline.is_set(): diff --git a/sugar_network/client/solver.py b/sugar_network/client/solver.py index 0b24579..67350b6 100644 --- a/sugar_network/client/solver.py +++ b/sugar_network/client/solver.py @@ -149,7 +149,7 @@ def solve(call, context, stability): if reason_exception is not None: reason = reason_exception.message else: - reason = 'Cannot find implementations for %s' % ', '.join(missed) + reason = 'Cannot find releases for %s' % ', '.join(missed) raise http.NotFound(reason) solution = [] @@ -209,10 +209,10 @@ def _load_feed(context): feed.to_resolve = feed_content.get('packages') if not feed.to_resolve: _logger.trace('[%s] No compatible packages', context) - for impl in feed_content['implementations']: + for impl in feed_content['releases']: feed.implement(impl) if not feed.to_resolve and not feed.implementations: - _logger.trace('[%s] No implementations', context) + _logger.trace('[%s] No releases', context) return feed @@ -242,7 +242,7 @@ class _Feed(model.ZeroInstallFeed): def resolve(self, packages): top_package = packages[0] - impl = _Implementation(self, self.context, None) + impl = _Release(self, self.context, None) impl.version = parse_version(top_package['version']) impl.released = 0 impl.arch = '*-%s' % (top_package['arch'] or '*') @@ -262,7 +262,7 @@ class _Feed(model.ZeroInstallFeed): impl_id = release['guid'] spec = release['data']['spec']['*-*'] - impl = _Implementation(self, impl_id, None) + impl = _Release(self, impl_id, None) impl.version = parse_version(release['version']) impl.released = 0 impl.arch = '*-*' @@ -288,7 +288,7 @@ class _Feed(model.ZeroInstallFeed): def implement_sugar(self, sugar_version): impl_id = 'sugar-%s' % sugar_version - impl = _Implementation(self, impl_id, None) + impl = _Release(self, impl_id, None) impl.version = parse_version(sugar_version) impl.released = 0 impl.arch = '*-*' @@ -302,7 +302,7 @@ class _Feed(model.ZeroInstallFeed): } -class _Implementation(model.ZeroInstallImplementation): +class _Release(model.ZeroInstallImplementation): to_install = None sn_impl = None diff --git a/sugar_network/model/__init__.py b/sugar_network/model/__init__.py index c846bc7..117649b 100644 --- a/sugar_network/model/__init__.py +++ b/sugar_network/model/__init__.py @@ -35,7 +35,7 @@ RESOURCES = ( 'sugar_network.model.artifact', 'sugar_network.model.comment', 'sugar_network.model.context', - 'sugar_network.model.implementation', + 'sugar_network.model.release', 'sugar_network.model.notification', 'sugar_network.model.feedback', 'sugar_network.model.report', diff --git a/sugar_network/model/implementation.py b/sugar_network/model/release.py index 53473e3..46eeaae 100644 --- a/sugar_network/model/implementation.py +++ b/sugar_network/model/release.py @@ -21,7 +21,7 @@ from sugar_network.toolkit.licenses import GOOD_LICENSES from sugar_network.toolkit.spec import parse_version -class Implementation(db.Resource): +class Release(db.Resource): @db.indexed_property(prefix='C', acl=ACL.CREATE | ACL.READ) diff --git a/sugar_network/model/report.py b/sugar_network/model/report.py index 8b2ca05..84db43a 100644 --- a/sugar_network/model/report.py +++ b/sugar_network/model/report.py @@ -24,13 +24,13 @@ class Report(db.Resource): return value @db.indexed_property(prefix='V', default='', acl=ACL.CREATE | ACL.READ) - def implementation(self, value): + def release(self, value): return value - @implementation.setter - def implementation(self, value): - if value and 'version' not in self.props and 'implementation' in value: - version = self.volume['implementation'].get(value) + @release.setter + def release(self, value): + if value and 'version' not in self.props and 'release' in value: + version = self.volume['release'].get(value) self['version'] = version['version'] return value diff --git a/sugar_network/model/routes.py b/sugar_network/model/routes.py index c5c4929..c8f8da6 100644 --- a/sugar_network/model/routes.py +++ b/sugar_network/model/routes.py @@ -31,10 +31,10 @@ class VolumeRoutes(db.Routes): mime_type='application/json') def feed(self, request, distro): context = self.volume['context'].get(request.guid) - implementations = self.volume['implementation'] + releases = self.volume['release'] versions = [] - impls, __ = implementations.find(context=context.guid, + impls, __ = releases.find(context=context.guid, not_layer='deleted', **request) for impl in impls: version = impl.properties([ @@ -51,7 +51,7 @@ class VolumeRoutes(db.Routes): del data[key] versions.append(version) - result = {'implementations': versions} + result = {'releases': versions} if distro: aliases = context['aliases'].get(distro) if aliases and 'binary' in aliases: diff --git a/sugar_network/node/master.py b/sugar_network/node/master.py index 9903fd8..19a8cf1 100644 --- a/sugar_network/node/master.py +++ b/sugar_network/node/master.py @@ -146,14 +146,14 @@ class MasterRoutes(NodeRoutes): def after_post(self, doc): if doc.metadata.name == 'context': - shift_implementations = doc.modified('dependencies') + shift_releases = doc.modified('dependencies') if doc.modified('aliases'): # TODO Already launched job should be killed coroutine.spawn(self._resolve_aliases, doc) - shift_implementations = True - if shift_implementations and not doc.is_new: + shift_releases = True + if shift_releases and not doc.is_new: # Shift checkpoint to invalidate solutions - self.volume['implementation'].checkpoint() + self.volume['release'].checkpoint() NodeRoutes.after_post(self, doc) def _push(self, stream): diff --git a/sugar_network/node/routes.py b/sugar_network/node/routes.py index ebb46a8..5f066a9 100644 --- a/sugar_network/node/routes.py +++ b/sugar_network/node/routes.py @@ -149,10 +149,10 @@ class NodeRoutes(model.VolumeRoutes, model.FrontRoutes): response.content_type = 'application/json' return result - @route('POST', ['implementation'], cmd='submit', + @route('POST', ['release'], cmd='submit', arguments={'initial': False}, mime_type='application/json', acl=ACL.AUTH) - def submit_implementation(self, request, document): + def submit_release(self, request, document): with toolkit.NamedTemporaryFile() as blob: shutil.copyfileobj(request.content_stream, blob) blob.flush() @@ -373,7 +373,7 @@ class NodeRoutes(model.VolumeRoutes, model.FrontRoutes): if 'stability' not in request: request['stability'] = 'stable' - impls, __ = self.volume['implementation'].find( + impls, __ = self.volume['release'].find( context=request.guid, order_by='-version', not_layer='deleted', **request) impl = None @@ -384,13 +384,13 @@ class NodeRoutes(model.VolumeRoutes, model.FrontRoutes): continue break else: - raise http.NotFound('No implementations found') + raise http.NotFound('No releases found') return impl def _get_clone(self, request, response): impl = self._solve(request) result = request.call(method=request.method, - path=['implementation', impl['guid'], 'data'], + path=['release', impl['guid'], 'data'], response=response) response.meta = impl.properties([ 'guid', 'ctime', 'layer', 'author', 'tags', @@ -437,12 +437,12 @@ def generate_node_stats(volume, path): for resource, props in [ ('user', []), ('context', []), - ('implementation', ['context']), + ('release', ['context']), ('artifact', ['context', 'type']), ('feedback', ['context']), ('solution', ['context', 'feedback']), ('review', ['context', 'artifact', 'rating']), - ('report', ['context', 'implementation']), + ('report', ['context', 'release']), ('comment', ['context', 'review', 'feedback', 'solution']), ]: objs, __ = volume[resource].find( @@ -454,7 +454,7 @@ def generate_node_stats(volume, path): for resource, props in [ ('user', ['layer']), ('context', ['layer']), - ('implementation', ['layer']), + ('release', ['layer']), ('artifact', ['layer']), ('feedback', ['layer', 'solution']), ('solution', ['layer']), @@ -498,7 +498,7 @@ def load_bundle(volume, request, bundle_path): contexts = volume['context'] context = impl.get('context') context_meta = None - impls = volume['implementation'] + impls = volume['release'] try: bundle = Bundle(bundle_path, mime_type='application/zip') @@ -574,8 +574,7 @@ def load_bundle(volume, request, bundle_path): context=context, version=impl['version'], not_layer='deleted') if 'url' not in data: data['blob'] = bundle_path - impl['guid'] = \ - request.call(method='POST', path=['implementation'], content=impl) + impl['guid'] = request.call(method='POST', path=['release'], content=impl) for i in existing: layer = i['layer'] + ['deleted'] impls.update(i.guid, {'layer': layer}) diff --git a/sugar_network/node/stats_node.py b/sugar_network/node/stats_node.py index 8a91994..cc77424 100644 --- a/sugar_network/node/stats_node.py +++ b/sugar_network/node/stats_node.py @@ -250,9 +250,9 @@ class _ContextStats(_ResourceStats): self['downloaded'] = 0 -class _ImplementationStats(_Stats): +class _ReleaseStats(_Stats): - RESOURCE = 'implementation' + RESOURCE = 'release' OWNERS = ['context'] def log(self, request): @@ -268,7 +268,7 @@ class _ImplementationStats(_Stats): class _ReportStats(_Stats): RESOURCE = 'report' - OWNERS = ['context', 'implementation'] + OWNERS = ['context', 'release'] def log(self, request): if request.method == 'POST': @@ -338,7 +338,7 @@ class _CommentStats(_ResourceStats): _STATS = {_UserStats.RESOURCE: _UserStats, _ContextStats.RESOURCE: _ContextStats, - _ImplementationStats.RESOURCE: _ImplementationStats, + _ReleaseStats.RESOURCE: _ReleaseStats, _ReportStats.RESOURCE: _ReportStats, _ReviewStats.RESOURCE: _ReviewStats, _FeedbackStats.RESOURCE: _FeedbackStats, diff --git a/sugar_network/node/volume.py b/sugar_network/node/volume.py index 00ff983..0c254f7 100644 --- a/sugar_network/node/volume.py +++ b/sugar_network/node/volume.py @@ -21,7 +21,7 @@ from sugar_network.toolkit import http, coroutine, enforce # Apply node level layer for these documents -_LIMITED_RESOURCES = ('context', 'implementation') +_LIMITED_RESOURCES = ('context', 'release') _logger = logging.getLogger('node.volume') 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 index 5960bb7..5960bb7 100644 --- a/tests/data/node/implementation/im/implementation/data.blob +++ b/tests/data/node/release/re/release/data.blob Binary files differ 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 index 5960bb7..5960bb7 100644 --- a/tests/data/node/implementation/im/implementation2/data.blob +++ b/tests/data/node/release/re/release2/data.blob Binary files differ 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]]}, -- cgit v0.9.1