@@ 32-44 (lines=13) @@ | ||
29 | self.filesys.write.assert_called_with(repo.datafile, |
|
30 | self.serializer.serializeList()) |
|
31 | ||
32 | def test_Update(self): |
|
33 | from niprov.jsonfile import JsonFile |
|
34 | repo = JsonFile(self.dependencies) |
|
35 | img1 = self.imageWithProvenance({'location':'1','path':'a'}) |
|
36 | img2 = self.imageWithProvenance({'location':'2','path':'b'}) |
|
37 | repo.all = Mock() |
|
38 | repo.all.return_value = [img1, img2] |
|
39 | image = self.imageWithProvenance({'location': '2','foo':'bar'}) |
|
40 | repo.update(image) |
|
41 | self.serializer.serializeList.assert_called_with( |
|
42 | [img1,image]) |
|
43 | self.filesys.write.assert_called_with(repo.datafile, |
|
44 | self.serializer.serializeList()) |
|
45 | ||
46 | def test_byLocation(self): |
|
47 | from niprov.jsonfile import JsonFile |
|
@@ 19-30 (lines=12) @@ | ||
16 | img.location.toString.return_value = prov['location'] |
|
17 | return img |
|
18 | ||
19 | def test_Add(self): |
|
20 | from niprov.jsonfile import JsonFile |
|
21 | repo = JsonFile(self.dependencies) |
|
22 | img1 = self.imageWithProvenance({'location':'1','foo':'baz'}) |
|
23 | repo.all = Mock() |
|
24 | repo.all.return_value = [img1] |
|
25 | image = self.imageWithProvenance({'location': '2','foo':'bar'}) |
|
26 | repo.add(image) |
|
27 | self.serializer.serializeList.assert_called_with( |
|
28 | [img1, image]) |
|
29 | self.filesys.write.assert_called_with(repo.datafile, |
|
30 | self.serializer.serializeList()) |
|
31 | ||
32 | def test_Update(self): |
|
33 | from niprov.jsonfile import JsonFile |