Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions freenit/project/.gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
.provisioned
.coverage
.pytest_cache
__pycache__
*.py[c,o]

ansible/group_vars/all
ansible/inventory/inventory
ansible/roles/*
ansible/site.yml
!ansible/roles/.keep
!ansible/roles/devel
build/

build
cbsd.conf
site.retry
coverage.xml
fstab
junit.xml
local_config.py
project.mk
site.retry
vars.mk

.ruff_cache
__pycache__
dist/
*.egg-info/
*.sqlite
*.egg-info
12 changes: 5 additions & 7 deletions freenit/project/tests/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import socket

from fastapi.testclient import TestClient
Expand All @@ -10,38 +9,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
1 change: 0 additions & 1 deletion tests/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import socket

from fastapi.testclient import TestClient
Expand Down
Loading