def test_add_value(self): with pytest.raises(TypeError) as err: containers = Containers() containers.add_value("rubbish") assert "must be of type" in str(err.value) # nosec with pytest.raises(TypeError) as err: containers = Containers() containers.set_num_shards("rubbish") # pylint: disable=line-too-long assert "num_shards parameter must be of type int" in str( err.value) # nosec # pylint: enable=line-too-long containers = Containers() containers.add_value(self.vos_container1) containers.add_value(self.vos_container2) containers.set_num_shards(500) raw_container1 = self.test_data.create_default_container(csum_gran=300) raw_container2 = self.test_data.create_default_container(csum_gran=400) want = { "num_shards": 500, "containers": [raw_container1, raw_container2] } assert want == containers.dump() # nosec
def _get_yaml_from_dfs(self, fse, use_average=False): dfs_sb = get_dfs_sb_obj() if use_average: dfs = fse.get_dfs_average() else: dfs = fse.get_dfs() container = dfs.get_container() container.add_value(dfs_sb) containers = Containers() containers.add_value(container) containers.set_num_shards(self._args.num_shards) return containers.dump()