def test_from_string(self, nd_json, executor, CommandProcessor): BulkAPI.from_string(nd_json, executor) CommandProcessor.assert_called_once_with( executor=executor, observer=Any.instance_of(Observer)) self._assert_process_called_with_generator_of_commands( CommandProcessor)
def test_we_catch_json_parsing_errors(self, config_command, executor): bad_string = json.dumps(config_command.raw) + '\n["Nonsense' with pytest.raises(InvalidJSONError): BulkAPI.from_string(bad_string, executor)