Skip to content

Commit 013a2b7

Browse files
committed
Improve tests for the generated project
1 parent 3e66575 commit 013a2b7

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

freenit/project/.gitignore

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
1-
.provisioned
1+
.coverage
2+
.pytest_cache
3+
__pycache__
4+
*.py[c,o]
5+
26
ansible/group_vars/all
37
ansible/inventory/inventory
48
ansible/roles/*
59
ansible/site.yml
610
!ansible/roles/.keep
711
!ansible/roles/devel
8-
build/
12+
13+
build
914
cbsd.conf
10-
site.retry
15+
coverage.xml
16+
fstab
17+
junit.xml
18+
local_config.py
1119
project.mk
20+
site.retry
1221
vars.mk
1322

14-
.ruff_cache
15-
__pycache__
23+
dist/
24+
*.egg-info/
1625
*.sqlite
17-
*.egg-info

freenit/project/tests/client.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import json
21
import socket
32

43
from fastapi.testclient import TestClient
@@ -10,38 +9,37 @@ def url_for(self, name, host=socket.gethostname()):
109

1110
def get(self, endpoint):
1211
url = self.url_for(endpoint)
13-
return super().get(url, cookies=self.cookies)
12+
return super().get(url)
1413

1514
def post(self, endpoint, data=None):
1615
url = self.url_for(endpoint)
1716
response = super().post(
1817
url,
1918
json=data,
2019
headers=self.headers,
21-
cookies=self.cookies,
2220
)
2321

2422
return response
2523

2624
def put(self, endpoint, data=None):
2725
url = self.url_for(endpoint)
28-
response = super().put(url, json=data, cookies=self.cookies)
26+
response = super().put(url, json=data)
2927
return response
3028

3129
def patch(self, endpoint, data=None):
3230
url = self.url_for(endpoint)
33-
response = super().patch(url, json=data, cookies=self.cookies)
31+
response = super().patch(url, json=data)
3432
return response
3533

3634
def delete(self, endpoint):
3735
url = self.url_for(endpoint)
38-
return super().delete(url, cookies=self.cookies)
36+
return super().delete(url)
3937

4038
def login(self, user, endpoint="/auth/login"):
4139
data = {
4240
"email": user.email,
4341
"password": "Sekrit",
4442
}
4543
response = self.post(endpoint, data)
46-
setattr(self, "cookies", response.cookies)
44+
self.cookies = response.cookies
4745
return response

tests/client.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import json
21
import socket
32

43
from fastapi.testclient import TestClient

0 commit comments

Comments
 (0)