Exemple #1
0
    def save_cassette(cls, cassette_path, cassette_dict, serializer):
        for cassette_request, cassette_response in zip(cassette_dict["requests"], cassette_dict["responses"]):
            if not cls.record_errors and get_in(["status", "code"], cassette_response) >= HTTPStatus.BAD_REQUEST:
                return

            cassette_request.uri = cassette_request.uri.replace(cls.base_uri, cls.mock_url)
            if cassette_request.body and xml_in_headers(cassette_request):
                cassette_request.body = strip_soap_namespaces_from_body(cassette_request.body)

            if any("xml" in content_type for content_type in cassette_response["headers"].get('Content-Type', [])):
                cassette_response["body"]["string"] = replace_locations_in_xml(cassette_response["body"]["string"])
        FilesystemPersister.save_cassette(cassette_path, cassette_dict, serializer)
Exemple #2
0
    def save_cassette(cassette_path, cassette_dict, serializer):
        if os.path.basename(
                cassette_path
        ) in CassetteOverwritingPersister.CASSETTES_TO_NEVER_OVERWRITE:
            return

        return FilesystemPersister.save_cassette(cassette_path, cassette_dict,
                                                 serializer)
Exemple #3
0
 def save_cassette(cassette_path, cassette_dict, serializer):
     cassette_path += ".test"
     FilesystemPersister.save_cassette(cassette_path, cassette_dict, serializer)
 def save_cassette(cassette_path, cassette_dict, serializer):
     cassette_path += '.test'
     FilesystemPersister.save_cassette(cassette_path, cassette_dict,
                                       serializer)