def test_parameter_parsing(self, code_name, parameters_name): code = json.loads(get_data(code_name)) parameters = json.loads(get_data(parameters_name)) schema = build_schema(code) data = decode_data(parameters, schema) res = encode_data(data, schema) self.assertDictEqual(parameters, res)
def test_storage_parsing(self, source_name): script = json.loads(get_data(source_name)) storage = next(s for s in script['code'] if s['prim'] == 'storage') schema = build_schema(storage) data = decode_data(script['storage'], schema) res = encode_data(data, schema) self.assertDictEqual(script['storage'], res)
def big_map_get(self, key): schema, key_path, val_path = self._get_big_map_schema() query = dict(key=encode_data(key, schema, root=key_path), type=schema.type_map[key_path]) value = self._node.post(f'{self._path}/big_map_get', json=query) return decode_data(value, schema, root=val_path)
def encode_parameters(self, data): return encode_data(data=data, schema=self._get_schema('parameter'))
def encode_storage(self, data): return encode_data(data=data, schema=self._get_schema('storage'))