def test_crud_item(client: TestClient, event_loop: asyncio.AbstractEventLoop): add_ecriture_droit(client, epci_id=status["epci_id"]) # POST /v2/action_status/epci_id response = client.post(post_path, json=status, headers=auth_headers()) assert response.status_code == 200 assert response.json()["action_id"] == status["action_id"] # GET /v2/action_status/epci_id/all response = client.get(list_path) assert response.status_code == 200 assert len(response.json()) == 1 assert response.json()[0]["action_id"] == status["action_id"] # GET /v2/action_status/epci_id/action_id response = client.get(item_path) assert response.status_code == 200 assert response.json()["action_id"] == status["action_id"]
def test_update(client: TestClient): add_ecriture_droit(client, epci_id=epci["uid"]) new_data = { "nom": "Blue Kingdom", } updated_epci = {**epci, **new_data} response = client.post(post_path, headers=auth_headers(), json=updated_epci) assert response.status_code == 200 assert response.json()["uid"] == epci["uid"] assert response.json()["nom"] == new_data["nom"] response = client.get(list_path) assert response.status_code == 200 assert len(response.json()) == 1 assert response.json()[0]["uid"] == epci["uid"] assert response.json()[0]["nom"] == new_data["nom"]
def test_update_fiche_action_categorie(client: TestClient): new_data = { "nom": "Alice", } existing_fiche_action_categorie = {**categorie, **new_data} post_path = f"{path}/{existing_fiche_action_categorie['epci_id']}" response = client.post(post_path, json=existing_fiche_action_categorie, headers=auth_headers()) assert response.status_code == 200 assert response.json()["uid"] == existing_fiche_action_categorie["uid"] assert response.json()["nom"] == existing_fiche_action_categorie["nom"] response = client.get(list_path) assert response.status_code == 200 assert len(response.json()) == 1 assert response.json()[0]["uid"] == existing_fiche_action_categorie["uid"] assert response.json()[0]["nom"] == existing_fiche_action_categorie["nom"]
def test_update_status(client: TestClient): add_ecriture_droit(client, epci_id=status["epci_id"]) new_data = { "avancement": "programmee", } new_status = {**status, **new_data} post_path = f"{path}/{new_status['epci_id']}" response = client.post(post_path, headers=auth_headers(), json=new_status) assert response.status_code == 200 assert response.json()["action_id"] == status["action_id"] assert response.json()["avancement"] == new_status["avancement"] response = client.get(list_path) assert response.status_code == 200 assert len(response.json()) == 1 assert response.json()[0]["action_id"] == status["action_id"] assert response.json()[0]["avancement"] == new_status["avancement"]
def test_update_indicateur_personnalise(client: TestClient): new_data = { "nom": "Cheshire Cat", } existing_indicateur_personnalise = {**indicateur_personnalise, **new_data} add_ecriture_droit(client, epci_id=existing_indicateur_personnalise["epci_id"]) post_path = f"{path}/{existing_indicateur_personnalise['epci_id']}" response = client.post( post_path, json=existing_indicateur_personnalise, headers=auth_headers() ) assert response.status_code == 200 assert response.json()["uid"] == existing_indicateur_personnalise["uid"] assert response.json()["nom"] == existing_indicateur_personnalise["nom"] response = client.get(list_path) assert response.status_code == 200 assert len(response.json()) == 1 assert response.json()[0]["uid"] == existing_indicateur_personnalise["uid"] assert response.json()[0]["nom"] == existing_indicateur_personnalise["nom"]
def test_update_indicateur_value(client: TestClient): new_data = { "value": "1234", } existing_indicateur_value = {**indicateur_value, **new_data} post_path = f"{path}/{existing_indicateur_value['epci_id']}" response = client.post(post_path, json=existing_indicateur_value, headers=auth_headers()) assert response.status_code == 200 assert (response.json()["indicateur_id"] == existing_indicateur_value["indicateur_id"]) assert response.json()["value"] == existing_indicateur_value["value"] response = client.get(list_path) assert response.status_code == 200 assert len(response.json()) == 1 assert (response.json()[0]["indicateur_id"] == existing_indicateur_value["indicateur_id"]) assert response.json()[0]["value"] == existing_indicateur_value["value"]
def test_crud_item(client: TestClient, event_loop: asyncio.AbstractEventLoop): add_ecriture_droit(client, epci_id=indicateur_referentiel_commentaire["epci_id"]) # POST /v2/indicateur_referentiel_commentaire/epci_id response = client.post(post_path, json=indicateur_referentiel_commentaire, headers=auth_headers()) assert response.status_code == 200 assert (response.json()["indicateur_id"] == indicateur_referentiel_commentaire["indicateur_id"]) # GET /v2/indicateur_referentiel_commentaire/epci_id/all response = client.get(list_path) assert response.status_code == 200 assert len(response.json()) == 1 assert (response.json()[0]["indicateur_id"] == indicateur_referentiel_commentaire["indicateur_id"]) # GET /v2/indicateur_referentiel_commentaire/epci_id/indicateur_id response = client.get(item_path) assert response.status_code == 200 assert (response.json()["indicateur_id"] == indicateur_referentiel_commentaire["indicateur_id"])
def test_droits(client: TestClient, event_loop: asyncio.AbstractEventLoop): # 401 # POST /v2/fiche_action/epci_id response = client.post(post_path, json=fiche_action, headers=auth_headers()) assert response.status_code == 401