Lines Matching refs:self
48 def __init__(self, **kwargs): argument
49 self.list_ops = False
50 self.stats = False
51 self.signatures = False
53 setattr(self, key, val)
54 if not hasattr(self, 'payload_file'):
55 self.payload_file = None
61 def __init__(self, src_extents, dst_extents, op_type, **kwargs): argument
62 self.src_extents = src_extents
63 self.dst_extents = dst_extents
64 self.type = op_type
66 setattr(self, key, val)
68 def HasField(self, field): argument
69 return hasattr(self, field)
74 def __init__(self, start_block, num_blocks): argument
75 self.start_block = start_block
76 self.num_blocks = num_blocks
81 def __init__(self, size): argument
82 self.size = size
88 def __init__(self, partition_name, operations, old_size, new_size): argument
89 self.partition_name = partition_name
90 self.operations = operations
91 self.old_partition_info = FakePartitionInfo(old_size)
92 self.new_partition_info = FakePartitionInfo(new_size)
98 def __init__(self): argument
99 self.partitions = [
114 self.block_size = 4096
115 self.minor_version = 4
116 self.signatures_offset = None
117 self.signatures_size = None
119 def HasField(self, field_name): argument
121 return hasattr(self, field_name) and getattr(self, field_name) is not None
127 def __init__(self, manifest_len, metadata_signature_len): argument
128 self.version = payload_info.MAJOR_PAYLOAD_VERSION_BRILLO
129 self.manifest_len = manifest_len
130 self.metadata_signature_len = metadata_signature_len
133 def size(self): argument
140 def __init__(self): argument
141 self._header = FakeHeader(222, 0)
142 self.header = None
143 self._manifest = FakeManifest()
144 self.manifest = None
146 self._blobs = {}
147 self._payload_signatures = update_metadata_pb2.Signatures()
148 self._metadata_signatures = update_metadata_pb2.Signatures()
150 def Init(self): argument
156 self.header = self._header
157 self.manifest = self._manifest
159 def ReadDataBlob(self, offset, length): argument
161 if not offset in self._blobs:
163 blob = self._blobs[offset]
176 def AddPayloadSignature(self, **kwargs): argument
177 self._AddSignatureToProto(self._payload_signatures, **kwargs)
178 blob = self._payload_signatures.SerializeToString()
179 self._manifest.signatures_offset = 1234
180 self._manifest.signatures_size = len(blob)
181 self._blobs[self._manifest.signatures_offset] = blob
183 def AddMetadataSignature(self, **kwargs): argument
184 self._AddSignatureToProto(self._metadata_signatures, **kwargs)
185 if self._header.metadata_signature_len:
186 del self._blobs[-self._header.metadata_signature_len]
187 blob = self._metadata_signatures.SerializeToString()
188 self._header.metadata_signature_len = len(blob)
189 self._blobs[-len(blob)] = blob
196 def OutputCapturer(self): argument
205 def TestCommand(self, payload_cmd, payload, expected_out): argument
212 self.OutputCapturer() as output:
214 self.assertEqual(output.getvalue(), expected_out)
216 def testDisplayValue(self): argument
218 with self.OutputCapturer() as output:
220 self.assertEqual(output.getvalue(), 'key: value\n')
222 def testRun(self): argument
234 self.TestCommand(payload_cmd, payload, expected_out)
236 def testListOpsOnVersion2(self): argument
263 self.TestCommand(payload_cmd, payload, expected_out)
265 def testStatsOnVersion2(self): argument
281 self.TestCommand(payload_cmd, payload, expected_out)
283 def testEmptySignatures(self): argument
298 self.TestCommand(payload_cmd, payload, expected_out)
300 def testSignatures(self): argument
330 self.TestCommand(payload_cmd, payload, expected_out)