Beispiel #1
0
    def enable_patching(self):
        if not HTTPretty.is_enabled():
            HTTPretty.enable()

        for method in HTTPretty.METHODS:
            for backend in self.backends_for_urls.values():
                for key, value in backend.urls.items():
                    HTTPretty.register_uri(
                        method=method,
                        uri=re.compile(key),
                        body=convert_httpretty_response(value),
                    )
Beispiel #2
0
    def enable_patching(self):
        if not HTTPretty.is_enabled():
            HTTPretty.enable()

        for method in HTTPretty.METHODS:
            for backend in self.backends_for_urls.values():
                for key, value in backend.urls.items():
                    HTTPretty.register_uri(
                        method=method,
                        uri=re.compile(key),
                        body=convert_httpretty_response(value),
                    )
Beispiel #3
0
    def start(self):
        self.backend.reset()
        HTTPretty.enable()

        for method in HTTPretty.METHODS:
            for key, value in self.backend.urls.iteritems():
                HTTPretty.register_uri(
                    method=method,
                    uri=re.compile(key),
                    body=value,
                )

            # Mock out localhost instance metadata
            HTTPretty.register_uri(
                method=method,
                uri=re.compile('http://169.254.169.254/latest/meta-data/.*'),
                body=metadata_response
            )
Beispiel #4
0
 def disable_patching(self):
     HTTPretty.disable()
     HTTPretty.reset()
Beispiel #5
0
 def reset(self):
     HTTPretty.reset()
Beispiel #6
0
 def disable_patching(self):
     HTTPretty.disable()
     HTTPretty.reset()
Beispiel #7
0
 def reset(self):
     HTTPretty.reset()
Beispiel #8
0
 def stop(self):
     HTTPretty.disable()