Python Forum

Full Version: Pytest with requests
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
    def createDomain(self, jsonData, tokenId):

        """
        Method used to create domains

        :param jsonData: Json request to designate
        :param tokenId: Token
        """
        status, content = self.doRequestDesignate('POST', '/v2/zones', json.dumps(jsonData), tokenId)

        return status, content
Hello, I would like to know if it is possible to test with pytest this type of code, I am a bit lost, can anyone help me?
Does this particular API has a sandbox environment?
(Mar-21-2019, 03:10 PM)buran Wrote: [ -> ]Does this particular API has a sandbox environment?
No, it's just a project in python
(Mar-21-2019, 03:20 PM)a21250450 Wrote: [ -> ]No, it's just a project in python
:-) It's a python project, but I guess you post a request to some real API endpoint, right? Normally API's would provide test/sandbox environment so that developers make test requests in sandbox (not production environment).

As an alternative you can mock the API