1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
from testbase import *
class SimpleRemoveTests(OperationsTests):
@staticmethod
def buildPkgs(pkgs, *args):
pkgs.leaf = FakePackage('foo', '2.5', '1.1', '0', 'noarch')
pkgs.leaf.addFile('/bin/foo')
pkgs.requires_leaf = FakePackage('bar', '4')
pkgs.requires_leaf.addRequires('foo')
pkgs.requires_file = FakePackage('barkeeper', '0.8')
pkgs.requires_file.addRequires('/bin/foo')
pkgs.rr_leaf = FakePackage('baz', '5.3')
pkgs.rr_leaf.addRequires('bar')
pkgs.provides_leaf = FakePackage('foo-ng', '2.5')
pkgs.provides_leaf.addProvides('foo')
def testRemoveSingle(self):
p = self.pkgs
res, msg = self.runOperation(['remove', 'foo'], [p.leaf], [])
self.assertTrue(res=='ok', msg)
self.assertResult( () )
def testRemoveRequired(self):
p = self.pkgs
res, msg = self.runOperation(['remove', 'foo'], [p.leaf, p.requires_leaf], [])
self.assertTrue(res=='ok', msg)
self.assertResult( () )
def testRemoveRequiredMissing(self):
p = self.pkgs
res, msg = self.runOperation(['remove', 'bar'], [p.requires_leaf], [])
self.assertTrue(res=='ok', msg)
self.assertResult( () )
def testRemoveRequiredProvided(self):
p = self.pkgs
res, msg = self.runOperation(['remove', 'foo'], [p.leaf, p.requires_leaf, p.provides_leaf], [])
self.assertTrue(res=='ok', msg)
self.assertResult( (p.requires_leaf, p.provides_leaf) )
def testRemoveRequiredAvailable(self):
p = self.pkgs
res, msg = self.runOperation(['remove', 'foo'], [p.leaf, p.requires_leaf], [p.provides_leaf])
self.assertTrue(res=='ok', msg)
self.assertResult( () )
def testRemoveRequiredChain(self):
p = self.pkgs
res, msg = self.runOperation(['remove', 'foo'], [p.leaf, p.requires_leaf, p.rr_leaf], [])
self.assertTrue(res=='ok', msg)
self.assertResult( () )
def testRemoveRequiredFile(self):
p = self.pkgs
res, msg = self.runOperation(['remove', 'foo'], [p.leaf, p.requires_file], [])
self.assertTrue(res=='ok', msg)
self.assertResult( () )
def testShellUpRm1(self):
""" Do an update for a package, and then rm it. """
pi1 = FakePackage('foo', '1', '1', '0', 'x86_64')
pa1 = FakePackage('foo', '2', '1', '0', 'x86_64')
res, msg = self.runOperation((['update', 'foo'],
['remove', 'foo'],
),
[pi1],
[pa1], multi_cmds=True)
self.assertTrue(res=='ok', msg)
self.assertResult(())
def testShellUpRm2(self):
""" Do an update for a package, and then rm it. """
pi1 = FakePackage('foo', '1', '1', '0', 'x86_64')
pi2 = FakePackage('foo', '1', '1', '0', 'i686')
pa1 = FakePackage('foo', '2', '1', '0', 'x86_64')
pa2 = FakePackage('foo', '2', '1', '0', 'i686')
res, msg = self.runOperation((['update', 'foo'],
['remove', 'foo.i686'],
),
[pi1, pi2],
[pa1, pa2], multi_cmds=True)
self.assertTrue(res=='ok', msg)
self.assertResult((pi1, ))
def testShellUpRm3(self):
""" Do an update for a package, and then rm it. """
pi1 = FakePackage('foo', '1', '1', '0', 'x86_64')
pi2 = FakePackage('foo', '1', '1', '0', 'i686')
pa1 = FakePackage('foo', '2', '1', '0', 'x86_64')
pa2 = FakePackage('foo', '2', '1', '0', 'i686')
res, msg = self.runOperation((['update', 'foo'],
['remove', 'foo.x86_64'],
),
[pi1, pi2],
[pa1, pa2], multi_cmds=True)
self.assertTrue(res=='ok', msg)
self.assertResult((pi2, ))
def testShellUpRm4(self):
""" Do an update for a package, and then rm it. """
pi1 = FakePackage('foo', '1', '1', '0', 'x86_64')
pi2 = FakePackage('foo', '1', '1', '0', 'i686')
pa1 = FakePackage('foo', '2', '1', '0', 'x86_64')
pa2 = FakePackage('foo', '2', '1', '0', 'i686')
res, msg = self.runOperation((['update', 'foo-2-1'],
['remove', 'foo.i686'],
),
[pi1, pi2],
[pa1, pa2], multi_cmds=True)
self.assertTrue(res=='ok', msg)
self.assertResult((pi1,))
|