bifurqué depuis cliss21/creme_center_fibois
Parent
f37eb0e887
révision
74245c6feb
2
Makefile
2
Makefile
|
@ -127,7 +127,7 @@ test: ### lance les tests de l'application
|
|||
$(PYTHON) -m pytest --cov --cov-report=term:skip-covered --no-migrations
|
||||
|
||||
test-wip: #### lance les tests marqués 'wip'
|
||||
$(PYTHON) -m pytest -vv -m 'wip' --pdb --no-migrations
|
||||
$(PYTHON) -m pytest --cov --cov-report=html -vv -m 'wip' --pdb --no-migrations
|
||||
|
||||
test-failed: #### lance les tests qui ont échoué
|
||||
$(PYTHON) -m pytest --lf --no-migrations
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
import json
|
||||
|
||||
from django.urls import reverse
|
||||
|
||||
import pytest
|
||||
|
||||
SECRET_TOKEN = 'my_secret_token'
|
||||
|
||||
|
||||
@pytest.mark.wip
|
||||
@pytest.mark.django_db
|
||||
def test_json_activites_bad_auth(client, settings):
|
||||
settings.TOKEN_BOIS_ET_VOUS = SECRET_TOKEN
|
||||
url = reverse('filiere_bois__portail_bois_et_vous_activite')
|
||||
result = client.get(url, {'token': 'no_good_token'})
|
||||
assert result.get('Content-Type') == 'application/json'
|
||||
assert result.status_code == 403
|
||||
|
||||
|
||||
@pytest.mark.wip
|
||||
@pytest.mark.django_db
|
||||
def test_json_activites_empty(client, settings):
|
||||
settings.TOKEN_BOIS_ET_VOUS = SECRET_TOKEN
|
||||
url = reverse('filiere_bois__portail_bois_et_vous_activite')
|
||||
result = client.get(url, {'token': SECRET_TOKEN})
|
||||
assert result.status_code == 200
|
||||
json_result = json.loads(result.content)
|
||||
assert json_result['count'] == 0
|
||||
|
||||
|
||||
@pytest.mark.wip
|
||||
@pytest.mark.django_db
|
||||
def test_json_annuaire_empty(client, settings):
|
||||
settings.TOKEN_BOIS_ET_VOUS = SECRET_TOKEN
|
||||
url = reverse('filiere_bois__portail_bois_et_vous')
|
||||
result = client.get(url, {'token': SECRET_TOKEN})
|
||||
assert result.status_code == 200
|
||||
json_result = json.loads(result.content)
|
||||
assert json_result['count'] == 0
|
|
@ -11,7 +11,7 @@ from center_pilote.pilote_extended.models import Organisation
|
|||
|
||||
|
||||
class BasePortailBoisEtVous(View):
|
||||
def get_data(self):
|
||||
def get_data(self): # pragma: no cover
|
||||
return {}
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
|
|
Chargement…
Référencer dans un nouveau ticket