How to use the pactman.mock.matchers.get_generated_values function in pactman

To help you get started, we’ve selected a few pactman examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reecetech / pactman / pactman / mock / response.py View on Github external
def json(self, spec_version):
        """Convert the Response to a JSON Pact."""
        response = {"status": self.status}
        if self.body is not None:
            response["body"] = get_generated_values(self.body)

        if self.headers:
            response["headers"] = get_generated_values(self.headers)

        if spec_version == "2.0.0":
            matchingRules = self.generate_v2_matchingRules()
        elif spec_version == "3.0.0":
            matchingRules = self.generate_v3_matchingRules()
        else:
            raise ValueError(f"Invalid Pact specification version={spec_version}")

        if matchingRules:
            response["matchingRules"] = matchingRules

        return response
github reecetech / pactman / pactman / mock / request.py View on Github external
def json(self, spec_version):
        """Convert the Request to a JSON Pact."""
        request = {"method": self.method, "path": get_generated_values(self.path)}

        if self.headers:
            request["headers"] = get_generated_values(self.headers)

        if self.body is not None:
            request["body"] = get_generated_values(self.body)

        if self.query:
            request["query"] = get_generated_values(self.query)

        if spec_version == "2.0.0":
            matchingRules = self.generate_v2_matchingRules()
        elif spec_version == "3.0.0":
            matchingRules = self.generate_v3_matchingRules()
        else:
            raise ValueError(f"Invalid Pact specification version={spec_version}")
github reecetech / pactman / pactman / mock / request.py View on Github external
def json(self, spec_version):
        """Convert the Request to a JSON Pact."""
        request = {"method": self.method, "path": get_generated_values(self.path)}

        if self.headers:
            request["headers"] = get_generated_values(self.headers)

        if self.body is not None:
            request["body"] = get_generated_values(self.body)

        if self.query:
            request["query"] = get_generated_values(self.query)

        if spec_version == "2.0.0":
            matchingRules = self.generate_v2_matchingRules()
        elif spec_version == "3.0.0":
            matchingRules = self.generate_v3_matchingRules()
        else:
            raise ValueError(f"Invalid Pact specification version={spec_version}")

        if matchingRules:
            request["matchingRules"] = matchingRules
github reecetech / pactman / pactman / mock / response.py View on Github external
def json(self, spec_version):
        """Convert the Response to a JSON Pact."""
        response = {"status": self.status}
        if self.body is not None:
            response["body"] = get_generated_values(self.body)

        if self.headers:
            response["headers"] = get_generated_values(self.headers)

        if spec_version == "2.0.0":
            matchingRules = self.generate_v2_matchingRules()
        elif spec_version == "3.0.0":
            matchingRules = self.generate_v3_matchingRules()
        else:
            raise ValueError(f"Invalid Pact specification version={spec_version}")

        if matchingRules:
            response["matchingRules"] = matchingRules

        return response
github reecetech / pactman / pactman / mock / request.py View on Github external
def json(self, spec_version):
        """Convert the Request to a JSON Pact."""
        request = {"method": self.method, "path": get_generated_values(self.path)}

        if self.headers:
            request["headers"] = get_generated_values(self.headers)

        if self.body is not None:
            request["body"] = get_generated_values(self.body)

        if self.query:
            request["query"] = get_generated_values(self.query)

        if spec_version == "2.0.0":
            matchingRules = self.generate_v2_matchingRules()
        elif spec_version == "3.0.0":
            matchingRules = self.generate_v3_matchingRules()
        else:
            raise ValueError(f"Invalid Pact specification version={spec_version}")

        if matchingRules:
            request["matchingRules"] = matchingRules
        return request
github reecetech / pactman / pactman / mock / request.py View on Github external
def json(self, spec_version):
        """Convert the Request to a JSON Pact."""
        request = {"method": self.method, "path": get_generated_values(self.path)}

        if self.headers:
            request["headers"] = get_generated_values(self.headers)

        if self.body is not None:
            request["body"] = get_generated_values(self.body)

        if self.query:
            request["query"] = get_generated_values(self.query)

        if spec_version == "2.0.0":
            matchingRules = self.generate_v2_matchingRules()
        elif spec_version == "3.0.0":
            matchingRules = self.generate_v3_matchingRules()
        else:
            raise ValueError(f"Invalid Pact specification version={spec_version}")

        if matchingRules:
            request["matchingRules"] = matchingRules
        return request