generateur_v3/backend/api/exo.py

12 lines
599 B
Python
Raw Normal View History

2023-01-27 21:41:08 +01:00
import requests
def exos(nb, username, password):
rr = requests.post('http://localhost:8002/register', data={"username": username,
'password': password, 'password_confirm': password})
token = rr.json()['access_token']
for i in range(nb):
2023-02-23 17:11:57 +01:00
r = requests.post('http://localhost:8002/exercices', data={"name": "Test" + str(i), "consigne": "consigne", "private": False}, files={
2023-01-27 21:41:08 +01:00
'file': ('test.py', open('./tests/testing_exo_source/exo_source.py', 'rb'))}, headers={"Authorization": "Bearer " + token})
2023-02-28 10:21:08 +01:00
2023-01-27 21:41:08 +01:00
2023-02-23 17:11:57 +01:00
exos(100, "lilianTest2", "Pomme937342")