def test_get_json(self): datalake_file = DatalakeFile(None, uri=self.uri, type=type) mock_func = create_autospec(datalake_file._get_json_from_remote, return_value=self.json_data) datalake_file._get_json_from_remote = mock_func data = datalake_file.get_json() self.assertEqual(data, self.json_data) mock_func.assert_called_once_with()
def test_get_json_from_remote(self): datalake_file = DatalakeFile(None, uri=self.uri, type=type) mock_response = self._build_json_response() datalake_file._do_download = MagicMock(return_value=mock_response) data = datalake_file._get_json_from_remote() self.assertEqual(data, self.json_data)