Skip to content

Commit

Permalink
Merge pull request #123 from mekanix/feature/fix-tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
mekanix authored Aug 23, 2023
2 parents f99f6ed + 9380015 commit dc6bc4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"test": [
"aiosqlite",
"black",
"httpx",
"isort",
"pytest-asyncio",
"pytest-factoryboy",
Expand Down
11 changes: 5 additions & 6 deletions tests/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,37 @@ def url_for(self, name, host=socket.gethostname()):

def get(self, endpoint):
url = self.url_for(endpoint)
return super().get(url, cookies=self.cookies)
return super().get(url)

def post(self, endpoint, data=None):
url = self.url_for(endpoint)
response = super().post(
url,
json=data,
headers=self.headers,
cookies=self.cookies,
)

return response

def put(self, endpoint, data=None):
url = self.url_for(endpoint)
response = super().put(url, json=data, cookies=self.cookies)
response = super().put(url, json=data)
return response

def patch(self, endpoint, data=None):
url = self.url_for(endpoint)
response = super().patch(url, json=data, cookies=self.cookies)
response = super().patch(url, json=data)
return response

def delete(self, endpoint):
url = self.url_for(endpoint)
return super().delete(url, cookies=self.cookies)
return super().delete(url)

def login(self, user, endpoint="/auth/login"):
data = {
"email": user.email,
"password": "Sekrit",
}
response = self.post(endpoint, data)
setattr(self, "cookies", response.cookies)
self.cookies = response.cookies
return response

0 comments on commit dc6bc4b

Please sign in to comment.