Untitled
unknown
python
a year ago
792 B
2
Indexable
Never
@patch('k8s.k8s_reader.config.load_incluster_config') @patch('k8s.k8s_reader.client.CustomObjectsApi') def setUp(self, mock_incluster_config, mock_custom_objects_api): self.mock_custom_objects_api = mock_custom_objects_api.return_value self.k8s_reader = K8sReader( in_cluster=True, group="test_group", version="test_version", namespace="test_namespace", plural="test_plural" ) def test_scrap_data(self): with open("test/valid_list.json") as file: mock_response = json.loads(file.read()) self.mock_custom_objects_api.list_namespaced_custom_object.return_value = mock_response result = self.k8s_reader.scrap_data() self.assertEqual(len(result), 2)