Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pytest with requests
#1
    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?
Reply
#2
Does this particular API has a sandbox environment?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(Mar-21-2019, 03:10 PM)buran Wrote: Does this particular API has a sandbox environment?
No, it's just a project in python
Reply
#4
(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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pytest Installed, but VS Code Won’t Access Pytest AstralWeeks 9 3,210 Sep-13-2023, 03:00 PM
Last Post: AstralWeeks
  Pytest mocks anthonyrmoss78 0 447 May-30-2023, 08:28 PM
Last Post: anthonyrmoss78
  Pytest and rootdirectory Master_Sergius 4 4,649 Jun-01-2020, 05:05 PM
Last Post: Master_Sergius
  pytest and caplog lazyliv 0 3,075 May-16-2018, 02:36 PM
Last Post: lazyliv

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020