Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests/units/client/solver.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units/client/solver.py')
-rwxr-xr-xtests/units/client/solver.py79
1 files changed, 2 insertions, 77 deletions
diff --git a/tests/units/client/solver.py b/tests/units/client/solver.py
index 84d5456..6e35a50 100755
--- a/tests/units/client/solver.py
+++ b/tests/units/client/solver.py
@@ -6,7 +6,7 @@ import os
from __init__ import tests
from sugar_network.client import IPCConnection, packagekit, solver, clones
-from sugar_network.toolkit import lsb_release, Option
+from sugar_network.toolkit import lsb_release
class SolverTest(tests.Test):
@@ -64,7 +64,7 @@ class SolverTest(tests.Test):
},
})
- solution = solver.solve(ipc, 'bundle_id')
+ solution = solver.solve(ipc, 'bundle_id', ['stable'])
self.assertEqual(
2, len(solution))
self.assertEqual(
@@ -74,81 +74,6 @@ class SolverTest(tests.Test):
('dep', '0'),
(solution[1]['context'], solution[1]['version']))
- def test_StabilityPreferences(self):
- self.start_online_client()
- ipc = IPCConnection()
- data = {'spec': {'*-*': {'commands': {'activity': {'exec': 'echo'}}, 'extract': 'topdir'}}}
-
- context = ipc.post(['context'], {
- 'type': 'activity',
- 'title': 'title',
- 'summary': 'summary',
- 'description': 'description',
- })
- impl1 = ipc.post(['implementation'], {
- 'context': context,
- 'license': 'GPLv3+',
- 'version': '1',
- 'stability': 'stable',
- 'notes': '',
- })
- self.node_volume['implementation'].update(impl1, {'data': data})
- impl2 = ipc.post(['implementation'], {
- 'context': context,
- 'license': 'GPLv3+',
- 'version': '2',
- 'stability': 'testing',
- 'notes': '',
- })
- self.node_volume['implementation'].update(impl2, {'data': data})
- impl3 = ipc.post(['implementation'], {
- 'context': context,
- 'license': 'GPLv3+',
- 'version': '3',
- 'stability': 'buggy',
- 'notes': '',
- })
- self.node_volume['implementation'].update(impl3, {'data': data})
- impl4 = ipc.post(['implementation'], {
- 'context': context,
- 'license': 'GPLv3+',
- 'version': '4',
- 'stability': 'insecure',
- 'notes': '',
- })
- self.node_volume['implementation'].update(impl4, {'data': data})
-
- self.assertEqual('1', solver.solve(ipc, context)[0]['version'])
-
- self.touch(('config', [
- '[stabilities]',
- '%s = testing' % context,
- ]))
- Option.load(['config'])
- self.assertEqual('2', solver.solve(ipc, context)[0]['version'])
-
- self.touch(('config', [
- '[stabilities]',
- '%s = testing buggy' % context,
- ]))
- Option.load(['config'])
- self.assertEqual('3', solver.solve(ipc, context)[0]['version'])
-
- self.touch(('config', [
- '[stabilities]',
- 'default = insecure',
- '%s = stable' % context,
- ]))
- Option.load(['config'])
- self.assertEqual('1', solver.solve(ipc, context)[0]['version'])
-
- self.touch(('config', [
- '[stabilities]',
- 'default = insecure',
- ]))
- Option.load(['config'])
- self.assertEqual('4', solver.solve(ipc, context)[0]['version'])
-
if __name__ == '__main__':
tests.main()