diff options
Diffstat (limited to 'tests/units/client')
-rwxr-xr-x | tests/units/client/cache.py | 2 | ||||
-rwxr-xr-x | tests/units/client/injector.py | 40 | ||||
-rwxr-xr-x | tests/units/client/offline_routes.py | 20 | ||||
-rwxr-xr-x | tests/units/client/online_routes.py | 44 | ||||
-rwxr-xr-x | tests/units/client/routes.py | 4 | ||||
-rwxr-xr-x | tests/units/client/server_routes.py | 8 | ||||
-rwxr-xr-x | tests/units/client/solver.py | 4 |
7 files changed, 61 insertions, 61 deletions
diff --git a/tests/units/client/cache.py b/tests/units/client/cache.py index 221572a..3342ce8 100755 --- a/tests/units/client/cache.py +++ b/tests/units/client/cache.py @@ -28,7 +28,7 @@ class CacheTest(tests.Test): cache_limit.value = 0 def test_get(self): - self.override(http.Client, 'download', lambda self_, path: StringIO(self.zips(('topdir/probe', '/'.join(path))))) + self.override(http.Connection, 'download', lambda self_, path: StringIO(self.zips(('topdir/probe', '/'.join(path))))) cache.get('impl', {'unpack_size': 100}) self.assertEqual(100, json.load(file('cache/implementation/impl/.unpack_size'))) self.assertEqual('implementation/impl/data', file('cache/implementation/impl/topdir/probe').read()) diff --git a/tests/units/client/injector.py b/tests/units/client/injector.py index c198f81..1010343 100755 --- a/tests/units/client/injector.py +++ b/tests/units/client/injector.py @@ -20,7 +20,7 @@ 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.client import IPCClient, packagekit, injector, clones, solver +from sugar_network.client import IPCConnection, packagekit, injector, clones, solver from sugar_network import client @@ -34,7 +34,7 @@ class InjectorTest(tests.Test): def test_clone(self): self.start_online_client([User, Context, Implementation]) - conn = IPCClient() + conn = IPCConnection() context = conn.post(['context'], { 'type': 'activity', @@ -112,7 +112,7 @@ Can't find all required implementations: def test_clone_impl(self): self.start_online_client([User, Context, Implementation]) - conn = IPCClient() + conn = IPCConnection() context = conn.post(['context'], { 'type': 'activity', @@ -159,7 +159,7 @@ Can't find all required implementations: def test_clone_CachedSolutionPointsToClonedPath(self): self.start_online_client([User, Context, Implementation]) - conn = IPCClient() + conn = IPCConnection() context = conn.post(['context'], { 'type': 'activity', @@ -198,7 +198,7 @@ Can't find all required implementations: def test_launch_Online(self): self.start_online_client([User, Context, Implementation]) - conn = IPCClient() + conn = IPCConnection() context = conn.post(['context'], { 'type': 'activity', @@ -325,7 +325,7 @@ Can't find all required implementations: def test_InstallDeps(self): self.start_online_client([User, Context, Implementation]) - conn = IPCClient() + conn = IPCConnection() context = conn.post(['context'], { 'type': 'activity', @@ -415,7 +415,7 @@ Can't find all required implementations: def test_SolutionsCache_Set(self): solution = [{'name': 'name', 'context': 'context', 'id': 'id', 'version': 'version'}] - self.override(client, 'IPCClient', lambda: _FakeConnection(True)) + self.override(client, 'IPCConnection', lambda: _FakeConnection(True)) self.override(solver, 'solve', lambda *args: solution) self.assertEqual(solution, injector._solve('context')) @@ -423,7 +423,7 @@ Can't find all required implementations: def test_SolutionsCache_InvalidateByAPIUrl(self): solution = [{'name': 'name', 'context': 'context', 'id': 'id', 'version': 'version'}] - self.override(client, 'IPCClient', lambda: _FakeConnection(True)) + self.override(client, 'IPCConnection', lambda: _FakeConnection(True)) self.override(solver, 'solve', lambda *args: solution) cached_path = 'cache/solutions/co/context' @@ -438,7 +438,7 @@ Can't find all required implementations: def test_SolutionsCache_InvalidateByMtime(self): solution = [{'name': 'name', 'context': 'context', 'id': 'id', 'version': 'version'}] - self.override(client, 'IPCClient', lambda: _FakeConnection(True)) + self.override(client, 'IPCConnection', lambda: _FakeConnection(True)) self.override(solver, 'solve', lambda *args: solution) cached_path = 'cache/solutions/co/context' @@ -459,7 +459,7 @@ Can't find all required implementations: def test_SolutionsCache_InvalidateByPMSMtime(self): solution = [{'name': 'name', 'context': 'context', 'id': 'id', 'version': 'version'}] - self.override(client, 'IPCClient', lambda: _FakeConnection(True)) + self.override(client, 'IPCConnection', lambda: _FakeConnection(True)) self.override(solver, 'solve', lambda *args: solution) cached_path = 'cache/solutions/co/context' @@ -486,13 +486,13 @@ Can't find all required implementations: self.override(solver, 'solve', lambda *args: solution1) cached_path = 'cache/solutions/co/context' - self.override(client, 'IPCClient', lambda: _FakeConnection(True)) + self.override(client, 'IPCConnection', lambda: _FakeConnection(True)) self.touch((cached_path, json.dumps([client.api_url.value, solution2]))) os.utime(cached_path, (1, 1)) injector.invalidate_solutions(2) self.assertEqual(solution1, injector._solve('context')) - self.override(client, 'IPCClient', lambda: _FakeConnection(False)) + self.override(client, 'IPCConnection', lambda: _FakeConnection(False)) self.touch((cached_path, json.dumps([client.api_url.value, solution2]))) os.utime(cached_path, (1, 1)) injector.invalidate_solutions(2) @@ -501,7 +501,7 @@ Can't find all required implementations: def test_SolutionsCache_InvalidateBySpecMtime(self): solution = [{'name': 'name', 'context': 'context', 'id': 'id', 'version': 'version'}] - self.override(client, 'IPCClient', lambda: _FakeConnection(True)) + self.override(client, 'IPCConnection', lambda: _FakeConnection(True)) self.override(solver, 'solve', lambda *args: solution) cached_path = 'cache/solutions/co/context' @@ -523,7 +523,7 @@ Can't find all required implementations: def test_clone_SetExecPermissionsForActivities(self): self.start_online_client([User, Context, Implementation]) - conn = IPCClient() + conn = IPCConnection() context = conn.post(['context'], { 'type': 'activity', @@ -569,7 +569,7 @@ Can't find all required implementations: def test_clone_InvalidateSolutionByAbsentImpls(self): self.start_online_client([User, Context, Implementation]) - conn = IPCClient() + conn = IPCConnection() context = conn.post(['context'], { 'type': 'activity', @@ -628,7 +628,7 @@ Can't find all required implementations: def test_ProcessCommonDependencies(self): self.start_online_client([User, Context, Implementation]) - conn = IPCClient() + conn = IPCConnection() context = conn.post(['context'], { 'type': 'activity', @@ -715,7 +715,7 @@ Can't find all required implementations: def test_LoadFeed_SetPackages(self): self.start_online_client([User, Context, Implementation]) - conn = IPCClient() + conn = IPCConnection() context = conn.post(['context'], { 'type': 'activity', @@ -788,7 +788,7 @@ Can't find all required implementations: imp.load_module('jarabe', file_, pathname_, description_) self.start_online_client([User, Context, Implementation]) - conn = IPCClient() + conn = IPCConnection() context = conn.post(['context'], { 'type': 'activity', @@ -858,7 +858,7 @@ Can't find all required implementations: imp.load_module('jarabe', file_, pathname_, description_) self.start_online_client([User, Context, Implementation]) - conn = IPCClient() + conn = IPCConnection() context = conn.post(['context'], { 'type': 'activity', @@ -915,7 +915,7 @@ Can't find all required implementations: home_volume = self.start_client() clones.populate(home_volume['context'], ['Activities']) - ipc = IPCClient() + ipc = IPCConnection() self.assertEqual([ {'context': 'context', 'state': 'fork'}, diff --git a/tests/units/client/offline_routes.py b/tests/units/client/offline_routes.py index ced30d1..961bbb5 100755 --- a/tests/units/client/offline_routes.py +++ b/tests/units/client/offline_routes.py @@ -6,7 +6,7 @@ from os.path import exists from __init__ import tests, src_root from sugar_network import client, model -from sugar_network.client import IPCClient, clones +from sugar_network.client import IPCConnection, clones from sugar_network.client.routes import ClientRoutes from sugar_network.db import Volume from sugar_network.toolkit.router import Router @@ -24,7 +24,7 @@ class OfflineRoutes(tests.Test): coroutine.dispatch() def test_NoAuthors(self): - ipc = IPCClient() + ipc = IPCConnection() guid = ipc.post(['context'], { 'type': 'activity', @@ -40,7 +40,7 @@ class OfflineRoutes(tests.Test): ipc.get(['context', guid, 'author'])) def test_HandleDeletes(self): - ipc = IPCClient() + ipc = IPCConnection() guid = ipc.post(['context'], { 'type': 'activity', @@ -57,14 +57,14 @@ class OfflineRoutes(tests.Test): assert not exists(guid_path) def test_whoami(self): - ipc = IPCClient() + ipc = IPCConnection() self.assertEqual( {'guid': tests.UID, 'roles': []}, ipc.get(cmd='whoami')) def test_clone(self): - ipc = IPCClient() + ipc = IPCConnection() context = ipc.post(['context'], { 'type': 'activity', @@ -76,7 +76,7 @@ class OfflineRoutes(tests.Test): self.assertRaises(RuntimeError, ipc.put, ['context', context], 1, cmd='clone') def test_favorite(self): - ipc = IPCClient() + ipc = IPCConnection() context = ipc.post(['context'], { 'type': 'activity', @@ -102,7 +102,7 @@ class OfflineRoutes(tests.Test): ipc.get(['context', context], reply=['favorite'])) def test_subscribe(self): - ipc = IPCClient() + ipc = IPCConnection() events = [] def read_events(): @@ -134,7 +134,7 @@ class OfflineRoutes(tests.Test): events) def test_BLOBs(self): - ipc = IPCClient() + ipc = IPCConnection() guid = ipc.post(['context'], { 'type': 'activity', @@ -185,7 +185,7 @@ class OfflineRoutes(tests.Test): 'requires = dep1; dep2 = 1; dep3 < 2; dep4 >= 3', ])) - ipc = IPCClient() + ipc = IPCConnection() monitor = coroutine.spawn(clones.monitor, self.home_volume['context'], ['Activities']) coroutine.dispatch() @@ -226,7 +226,7 @@ class OfflineRoutes(tests.Test): ipc.get(['context', 'bundle_id'], cmd='feed')) def test_LocalAPIShouldDuplicateNodeButWith503Response(self): - ipc = IPCClient() + ipc = IPCConnection() self.assertRaises(http.ServiceUnavailable, ipc.get, ['context', 'foo'], cmd='feed') self.assertRaises(http.ServiceUnavailable, ipc.get, ['packages', 'foo', 'bar']) diff --git a/tests/units/client/online_routes.py b/tests/units/client/online_routes.py index 10d9b4b..7dc3409 100755 --- a/tests/units/client/online_routes.py +++ b/tests/units/client/online_routes.py @@ -12,7 +12,7 @@ from os.path import exists from __init__ import tests, src_root from sugar_network import client, db, model -from sugar_network.client import IPCClient, journal, clones, injector, routes +from sugar_network.client import IPCConnection, journal, clones, injector, routes from sugar_network.toolkit import coroutine, http from sugar_network.toolkit.spec import Spec from sugar_network.client.routes import ClientRoutes, Request, Response @@ -52,7 +52,7 @@ class OnlineRoutes(tests.Test): def test_whoami(self): self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() self.assertEqual( {'guid': tests.UID, 'roles': []}, @@ -60,7 +60,7 @@ class OnlineRoutes(tests.Test): def test_clone_Activities(self): self.home_volume = self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() coroutine.spawn(clones.monitor, self.home_volume['context'], ['Activities']) context = ipc.post(['context'], { @@ -159,7 +159,7 @@ class OnlineRoutes(tests.Test): def test_clone_ActivityImpl(self): self.home_volume = self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() coroutine.spawn(clones.monitor, self.home_volume['context'], ['Activities']) context = ipc.post(['context'], { @@ -296,7 +296,7 @@ class OnlineRoutes(tests.Test): self.override(journal.Routes, 'journal_update', journal_update) self.override(journal.Routes, 'journal_delete', lambda self, guid: updates.append((guid,))) - ipc = IPCClient() + ipc = IPCConnection() context = ipc.post(['context'], { 'type': 'content', @@ -374,7 +374,7 @@ class OnlineRoutes(tests.Test): self.override(journal.Routes, 'journal_update', journal_update) self.override(journal.Routes, 'journal_delete', lambda self, guid: updates.append((guid,))) - ipc = IPCClient() + ipc = IPCConnection() artifact = ipc.post(['artifact'], { 'context': 'context', @@ -433,7 +433,7 @@ class OnlineRoutes(tests.Test): def test_favorite(self): self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() context = ipc.post(['context'], { 'type': 'activity', @@ -474,7 +474,7 @@ class OnlineRoutes(tests.Test): def test_subscribe(self): self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() events = [] def read_events(): @@ -532,7 +532,7 @@ class OnlineRoutes(tests.Test): def test_BLOBs(self): self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() guid = ipc.post(['context'], { 'type': 'activity', @@ -564,7 +564,7 @@ class OnlineRoutes(tests.Test): def test_Feeds(self): self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() context = ipc.post(['context'], { 'type': 'activity', @@ -631,7 +631,7 @@ class OnlineRoutes(tests.Test): def test_Feeds_RestrictLayers(self): self.start_online_client([User, Context, Implementation, Artifact]) - ipc = IPCClient() + ipc = IPCConnection() context = ipc.post(['context'], { 'type': 'activity', @@ -773,7 +773,7 @@ class OnlineRoutes(tests.Test): def test_Feeds_PreferLocalFeeds(self): home_volume = self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() context = ipc.post(['context'], { 'type': 'activity', @@ -840,7 +840,7 @@ class OnlineRoutes(tests.Test): def test_InvalidateSolutions(self): self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() self.assertNotEqual(None, injector._mtime) mtime = injector._mtime @@ -891,7 +891,7 @@ class OnlineRoutes(tests.Test): def test_ContentDisposition(self): self.start_online_client([User, Context, Implementation, Artifact]) - ipc = IPCClient() + ipc = IPCConnection() artifact = ipc.post(['artifact'], { 'type': 'instance', @@ -916,7 +916,7 @@ class OnlineRoutes(tests.Test): raise http.Redirect(URL) self.start_online_client([User, Document]) - ipc = IPCClient() + ipc = IPCConnection() guid = ipc.post(['document'], {}) response = requests.request('GET', client.api_url.value + '/document/' + guid + '/blob', allow_redirects=False) @@ -925,7 +925,7 @@ class OnlineRoutes(tests.Test): def test_Proxy_Activities(self): home_volume = self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() context = ipc.post(['context'], { 'type': 'activity', @@ -960,7 +960,7 @@ class OnlineRoutes(tests.Test): def test_Proxy_Content(self): self.start_online_client([User, Context, Implementation, Artifact]) - ipc = IPCClient() + ipc = IPCConnection() guid = ipc.post(['context'], { 'type': 'content', @@ -996,7 +996,7 @@ class OnlineRoutes(tests.Test): def test_Proxy_Artifacts(self): self.start_online_client([User, Context, Implementation, Artifact]) - ipc = IPCClient() + ipc = IPCConnection() guid = ipc.post(['artifact'], { 'type': 'instance', @@ -1032,7 +1032,7 @@ class OnlineRoutes(tests.Test): def test_Proxy_NoNeedlessRemoteRequests(self): home_volume = self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() guid = ipc.post(['context'], { 'type': 'content', @@ -1058,7 +1058,7 @@ class OnlineRoutes(tests.Test): def test_HomeVolumeEvents(self): self.home_volume = self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() coroutine.spawn(clones.monitor, self.home_volume['context'], ['Activities']) context1 = ipc.post(['context'], { @@ -1139,7 +1139,7 @@ class OnlineRoutes(tests.Test): self.override(routes, '_LocalRoutes', LocalRoutes) home_volume = self.start_client([User]) - ipc = IPCClient() + ipc = IPCConnection() self.assertEqual('local', ipc.get(cmd='sleep')) self.assertEqual('local', ipc.get(cmd='yield_raw_and_sleep')) @@ -1208,7 +1208,7 @@ class OnlineRoutes(tests.Test): node_pid = self.fork_master([User]) self.start_client([User]) - ipc = IPCClient() + ipc = IPCConnection() self.wait_for_events(ipc, event='inline', state='online').wait() def shutdown(): diff --git a/tests/units/client/routes.py b/tests/units/client/routes.py index 8ae8d44..e69c7ed 100755 --- a/tests/units/client/routes.py +++ b/tests/units/client/routes.py @@ -6,7 +6,7 @@ import json from __init__ import tests from sugar_network import db, client, model -from sugar_network.client import journal, injector, IPCClient +from sugar_network.client import journal, injector, IPCConnection from sugar_network.client.routes import ClientRoutes, CachedClientRoutes from sugar_network.model.user import User from sugar_network.model.report import Report @@ -67,7 +67,7 @@ class RoutesTest(tests.Test): def test_InlineSwitchInFind(self): self.home_volume = self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() guid1 = ipc.post(['context'], { 'type': 'activity', diff --git a/tests/units/client/server_routes.py b/tests/units/client/server_routes.py index bea8f7f..d1ffda0 100755 --- a/tests/units/client/server_routes.py +++ b/tests/units/client/server_routes.py @@ -8,7 +8,7 @@ from os.path import exists from __init__ import tests, src_root from sugar_network import db, client, model -from sugar_network.client import IPCClient +from sugar_network.client import IPCConnection from sugar_network.client.routes import ClientRoutes from sugar_network.db import Volume from sugar_network.toolkit.router import Router @@ -65,7 +65,7 @@ class ServerCommandsTest(tests.Test): def test_whoami(self): self.start_node() - ipc = IPCClient() + ipc = IPCConnection() self.assertEqual( {'guid': tests.UID, 'roles': []}, @@ -73,7 +73,7 @@ class ServerCommandsTest(tests.Test): def test_subscribe(self): self.start_node() - ipc = IPCClient() + ipc = IPCConnection() events = [] def read_events(): @@ -104,7 +104,7 @@ class ServerCommandsTest(tests.Test): def test_BLOBs(self): self.start_node() - ipc = IPCClient() + ipc = IPCConnection() guid = ipc.post(['context'], { 'type': 'activity', diff --git a/tests/units/client/solver.py b/tests/units/client/solver.py index 42499fe..b4bed8d 100755 --- a/tests/units/client/solver.py +++ b/tests/units/client/solver.py @@ -5,7 +5,7 @@ import os from __init__ import tests -from sugar_network.client import IPCClient, packagekit, solver, clones +from sugar_network.client import IPCConnection, packagekit, solver, clones from sugar_network.toolkit import lsb_release @@ -48,7 +48,7 @@ class SolverTest(tests.Test): home_volume = self.start_online_client() clones.populate(home_volume['context'], ['Activities']) - ipc = IPCClient() + ipc = IPCConnection() ipc.post(['context'], { 'guid': 'dep', |