diff options
Diffstat (limited to 'tests/units')
-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 | ||||
-rwxr-xr-x | tests/units/model/comment.py | 4 | ||||
-rwxr-xr-x | tests/units/model/context.py | 4 | ||||
-rwxr-xr-x | tests/units/model/implementation.py | 4 | ||||
-rwxr-xr-x | tests/units/model/review.py | 4 | ||||
-rwxr-xr-x | tests/units/model/solution.py | 4 | ||||
-rwxr-xr-x | tests/units/node/master.py | 12 | ||||
-rwxr-xr-x | tests/units/node/node.py | 10 | ||||
-rwxr-xr-x | tests/units/node/obs.py | 6 | ||||
-rwxr-xr-x | tests/units/node/sync_online.py | 16 | ||||
-rwxr-xr-x | tests/units/toolkit/http.py | 4 |
17 files changed, 95 insertions, 95 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', diff --git a/tests/units/model/comment.py b/tests/units/model/comment.py index 7cf23b9..4b97723 100755 --- a/tests/units/model/comment.py +++ b/tests/units/model/comment.py @@ -3,7 +3,7 @@ from __init__ import tests -from sugar_network.client import Client +from sugar_network.client import Connection from sugar_network.model.user import User from sugar_network.model.context import Context from sugar_network.model.review import Review @@ -18,7 +18,7 @@ class CommentTest(tests.Test): def test_SetContext(self): volume = self.start_master([User, Context, Review, Feedback, Solution, Comment, Implementation]) - client = Client() + client = Connection() self.assertRaises(http.NotFound, client.post, ['comment'], {'message': '', 'review': 'absent'}) self.assertRaises(http.NotFound, client.post, ['comment'], {'message': '', 'feedback': 'absent'}) diff --git a/tests/units/model/context.py b/tests/units/model/context.py index d8c5628..c63ab14 100755 --- a/tests/units/model/context.py +++ b/tests/units/model/context.py @@ -4,7 +4,7 @@ from __init__ import tests from sugar_network.node import obs -from sugar_network.client import IPCClient, Client +from sugar_network.client import IPCConnection from sugar_network.toolkit import coroutine, enforce @@ -12,7 +12,7 @@ class ContextTest(tests.Test): def test_SetCommonLayerForPackages(self): self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() guid = ipc.post(['context'], { 'type': 'package', diff --git a/tests/units/model/implementation.py b/tests/units/model/implementation.py index a3afd4b..ea238c7 100755 --- a/tests/units/model/implementation.py +++ b/tests/units/model/implementation.py @@ -10,7 +10,7 @@ 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.client import IPCClient +from sugar_network.client import IPCConnection from sugar_network.toolkit import http, coroutine @@ -66,7 +66,7 @@ class ImplementationTest(tests.Test): def test_WrongAuthor(self): self.start_online_client() - client = IPCClient() + client = IPCConnection() self.node_volume['context'].create({ 'guid': 'context', diff --git a/tests/units/model/review.py b/tests/units/model/review.py index 0e50f5a..5cde1df 100755 --- a/tests/units/model/review.py +++ b/tests/units/model/review.py @@ -3,7 +3,7 @@ from __init__ import tests -from sugar_network.client import Client +from sugar_network.client import Connection from sugar_network.model.user import User from sugar_network.model.context import Context from sugar_network.model.review import Review @@ -15,7 +15,7 @@ class ReviewTest(tests.Test): def test_SetContext(self): volume = self.start_master([User, Context, Review, Artifact, Implementation]) - client = Client() + client = Connection() context = client.post(['context'], { 'type': 'package', diff --git a/tests/units/model/solution.py b/tests/units/model/solution.py index dafb5a7..908653d 100755 --- a/tests/units/model/solution.py +++ b/tests/units/model/solution.py @@ -3,7 +3,7 @@ from __init__ import tests -from sugar_network.client import Client +from sugar_network.client import Connection from sugar_network.model.user import User from sugar_network.model.context import Context from sugar_network.model.feedback import Feedback @@ -15,7 +15,7 @@ class SolutionTest(tests.Test): def test_SetContext(self): volume = self.start_master([User, Context, Feedback, Solution, Implementation]) - client = Client() + client = Connection() context = client.post(['context'], { 'type': 'package', diff --git a/tests/units/node/master.py b/tests/units/node/master.py index f5dbc1b..bae7d39 100755 --- a/tests/units/node/master.py +++ b/tests/units/node/master.py @@ -6,7 +6,7 @@ import os from __init__ import tests from sugar_network.node import obs -from sugar_network.client import IPCClient +from sugar_network.client import IPCConnection from sugar_network.toolkit import coroutine, enforce @@ -21,7 +21,7 @@ class MasterTest(tests.Test): self.override(obs, 'resolve', lambda repo, arch, names: ['fake']) self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() guid = ipc.post(['context'], { 'type': 'activity', @@ -57,7 +57,7 @@ class MasterTest(tests.Test): self.override(obs, 'resolve', lambda repo, arch, names: enforce(False, 'resolve failed')) self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() guid = ipc.post(['context'], { 'type': 'activity', @@ -96,7 +96,7 @@ class MasterTest(tests.Test): self.override(obs, 'resolve', resolve) self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() guid = ipc.post(['context'], { 'type': 'activity', @@ -148,7 +148,7 @@ class MasterTest(tests.Test): self.override(obs, 'resolve', lambda repo, arch, names: ['fake']) self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() events = [] def read_events(): @@ -184,7 +184,7 @@ class MasterTest(tests.Test): def test_InvalidateSolutionsOnDependenciesChanges(self): self.start_online_client() - ipc = IPCClient() + ipc = IPCConnection() events = [] def read_events(): diff --git a/tests/units/node/node.py b/tests/units/node/node.py index 65495f1..26b2741 100755 --- a/tests/units/node/node.py +++ b/tests/units/node/node.py @@ -11,7 +11,7 @@ from os.path import exists from __init__ import tests from sugar_network import db, node, model -from sugar_network.client import Client +from sugar_network.client import Connection from sugar_network.toolkit import http, coroutine from sugar_network.toolkit.rrd import Rrd from sugar_network.node import stats_user, stats_node, obs @@ -481,7 +481,7 @@ class NodeTest(tests.Test): node.files_root.value = '.' self.touch(('packages/repo/arch/package', 'file')) volume = self.start_master() - client = Client() + client = Connection() self.assertEqual(['repo'], client.get(['packages'])) self.assertEqual(['arch'], client.get(['packages', 'repo'])) @@ -497,7 +497,7 @@ class NodeTest(tests.Test): ('packages/repo/2.2', '', 2), ) volume = self.start_master() - ipc = Client() + ipc = Connection() self.assertEqual( sorted(['1', '2']), @@ -529,7 +529,7 @@ class NodeTest(tests.Test): def test_Clone(self): volume = self.start_master() - client = Client() + client = Connection() context = client.post(['context'], { 'type': 'activity', @@ -624,7 +624,7 @@ class NodeTest(tests.Test): def test_release(self): volume = self.start_master() - conn = Client() + conn = Connection() conn.post(['context'], { 'guid': 'bundle_id', diff --git a/tests/units/node/obs.py b/tests/units/node/obs.py index aaf4030..fef1b1d 100755 --- a/tests/units/node/obs.py +++ b/tests/units/node/obs.py @@ -18,7 +18,7 @@ class ObsTest(tests.Test): obs._repos = {} def test_get_repos(self): - self.override(http, 'Client', Client(self, [ + self.override(http, 'Connection', Client(self, [ (('GET', ['build', 'base']), {'allowed': (400, 404)}, [ '<directory>', ' <entry name="Debian-6.0" />', @@ -45,7 +45,7 @@ class ObsTest(tests.Test): obs.get_repos()) def test_resolve(self): - self.override(http, 'Client', Client(self, [ + self.override(http, 'Connection', Client(self, [ (('GET', ['resolve']), {'allowed': (400, 404), 'params': { 'project': 'base', @@ -75,7 +75,7 @@ class ObsTest(tests.Test): obs.resolve('repo', 'arch', ['pkg1', 'pkg2']) def test_presolve(self): - self.override(http, 'Client', lambda *args: Client(self, [ + self.override(http, 'Connection', lambda *args: Client(self, [ (('GET', ['build', 'presolve']), {'allowed': (400, 404)}, [ '<directory>', ' <entry name="OLPC-11.3.1" />', diff --git a/tests/units/node/sync_online.py b/tests/units/node/sync_online.py index c8bf5f8..4b46306 100755 --- a/tests/units/node/sync_online.py +++ b/tests/units/node/sync_online.py @@ -8,7 +8,7 @@ from os.path import exists from __init__ import tests from sugar_network import db, toolkit -from sugar_network.client import Client, api_url +from sugar_network.client import Connection, api_url from sugar_network.node import sync, stats_user, files_root from sugar_network.node.master import MasterRoutes from sugar_network.node.slave import SlaveRoutes @@ -59,7 +59,7 @@ class SyncOnlineTest(tests.Test): tests.Test.tearDown(self) def test_Push(self): - client = Client('http://127.0.0.1:9001') + client = Connection('http://127.0.0.1:9001') # Sync users client.post(cmd='online-sync') @@ -129,14 +129,14 @@ class SyncOnlineTest(tests.Test): def test_PushStats(self): stats_user.stats_user.value = True - client = Client('http://127.0.0.1:9001') + client = Connection('http://127.0.0.1:9001') client.post(cmd='online-sync') self.assertEqual(['ok'], self.stats_commit) self.assertEqual([{'stats': 'probe'}], self.stats_merge) def test_Pull(self): - client = Client('http://127.0.0.1:9000') - slave_client = Client('http://127.0.0.1:9001') + client = Connection('http://127.0.0.1:9000') + slave_client = Connection('http://127.0.0.1:9001') # Sync users slave_client.post(cmd='online-sync') @@ -210,7 +210,7 @@ class SyncOnlineTest(tests.Test): self.touch(('master/files/3/3/3', 'ccc', 3)) os.utime('master/files', (1, 1)) - client = Client('http://127.0.0.1:9001') + client = Connection('http://127.0.0.1:9001') client.post(cmd='online-sync') files, stamp = json.load(file('master/files.index')) @@ -228,8 +228,8 @@ class SyncOnlineTest(tests.Test): self.assertEqual('ccc', file('slave/files/3/3/3').read()) def test_PullFromPreviouslyMergedRecord(self): - master = Client('http://127.0.0.1:9000') - slave = Client('http://127.0.0.1:9001') + master = Connection('http://127.0.0.1:9000') + slave = Connection('http://127.0.0.1:9001') # Sync users slave.post(cmd='online-sync') diff --git a/tests/units/toolkit/http.py b/tests/units/toolkit/http.py index 4117cbc..7a63176 100755 --- a/tests/units/toolkit/http.py +++ b/tests/units/toolkit/http.py @@ -28,7 +28,7 @@ class HTTPTest(tests.Test): self.server = coroutine.WSGIServer(('127.0.0.1', local.ipc_port.value), Router(CommandsProcessor())) coroutine.spawn(self.server.serve_forever) coroutine.dispatch() - client = http.Client('http://127.0.0.1:%s' % local.ipc_port.value) + client = http.Connection('http://127.0.0.1:%s' % local.ipc_port.value) events = [] CommandsProcessor.events = ['', 'fake', 'data: fail', 'data: null', 'data: -1', 'data: {"foo": "bar"}'] @@ -69,7 +69,7 @@ class HTTPTest(tests.Test): self.server = coroutine.WSGIServer(('127.0.0.1', local.ipc_port.value), Router(Commands())) coroutine.spawn(self.server.serve_forever) coroutine.dispatch() - client = http.Client('http://127.0.0.1:%s' % local.ipc_port.value) + client = http.Connection('http://127.0.0.1:%s' % local.ipc_port.value) request = Request({ 'REQUEST_METHOD': 'GET', |