-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #256 from MTES-MCT/icpe2
Possibilité de stipuler qu'e avis réglementaire concerne un projet ICPE
- Loading branch information
Showing
26 changed files
with
578 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...go/evaluations/migrations/0020_evaluation_is_icpe_alter_evaluation_details_md_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.2 on 2023-10-23 14:17 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("evaluations", "0019_alter_evaluation_created_surface"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="evaluation", | ||
name="is_icpe", | ||
field=models.BooleanField(default=False, verbose_name="Is ICPE?"), | ||
), | ||
] |
12 changes: 12 additions & 0 deletions
12
envergo/evaluations/migrations/0021_merge_20231129_0837.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Generated by Django 4.2 on 2023-11-29 08:37 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("evaluations", "0020_alter_evaluation_notice_log_cascade"), | ||
("evaluations", "0020_evaluation_is_icpe_alter_evaluation_details_md_and_more"), | ||
] | ||
|
||
operations = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -474,3 +474,122 @@ def test_required_action_interdit(rf, moulinette_url): | |
) | ||
assert "action attendue du porteur" not in body | ||
assert "action requise interdit" in body | ||
|
||
|
||
@pytest.mark.parametrize("footprint", [50]) | ||
def test_instructor_icpe_send_to_sponsor(rf, moulinette_url): | ||
"""Test email when evalreq is: | ||
- created by an instructor | ||
- the "icpe" checkbox is checked | ||
- send eval to sponsor is checked | ||
""" | ||
eval_kwargs = { | ||
"user_type": USER_TYPES.instructor, | ||
"moulinette_url": moulinette_url, | ||
"send_eval_to_sponsor": True, | ||
"is_icpe": True, | ||
} | ||
eval, moulinette = fake_moulinette( | ||
moulinette_url, | ||
"soumis", | ||
"non_soumis", | ||
"non_soumis", | ||
"non_soumis", | ||
**eval_kwargs, | ||
) | ||
|
||
req = rf.get("/") | ||
eval_email = eval.get_evaluation_email() | ||
email = eval_email.get_email(req) | ||
assert email.to == ["[email protected]"] | ||
assert email.cc == [] | ||
assert email.bcc == [] | ||
|
||
body = email.body | ||
assert "À transmettre au porteur" not in body | ||
assert ( | ||
"Le projet semble être une Installation Classée pour la Protection de l’Environnement (ICPE)" | ||
in body | ||
) | ||
assert ( | ||
"nous n’avons pas envoyé cet avis directement au porteur, car EnvErgo ne se prononce pas encore" | ||
in body | ||
) | ||
|
||
|
||
@pytest.mark.parametrize("footprint", [50]) | ||
def test_instructor_icpe_dont_send_to_sponsor(rf, moulinette_url): | ||
"""Test email when evalreq is: | ||
- created by an instructor | ||
- the "icpe" checkbox is checked | ||
- send eval to sponsor is not checked | ||
""" | ||
eval_kwargs = { | ||
"user_type": USER_TYPES.instructor, | ||
"moulinette_url": moulinette_url, | ||
"send_eval_to_sponsor": False, | ||
"is_icpe": True, | ||
} | ||
eval, moulinette = fake_moulinette( | ||
moulinette_url, | ||
"soumis", | ||
"non_soumis", | ||
"non_soumis", | ||
"non_soumis", | ||
**eval_kwargs, | ||
) | ||
|
||
req = rf.get("/") | ||
eval_email = eval.get_evaluation_email() | ||
email = eval_email.get_email(req) | ||
assert email.to == ["[email protected]"] | ||
assert email.cc == [] | ||
assert email.bcc == [] | ||
|
||
body = email.body | ||
assert "À transmettre au porteur" not in body | ||
assert ( | ||
"Le projet semble être une Installation Classée pour la Protection de l’Environnement (ICPE)" | ||
in body | ||
) | ||
assert ( | ||
"nous n’avons pas envoyé cet avis directement au porteur, car EnvErgo ne se prononce pas encore" | ||
not in body | ||
) | ||
|
||
|
||
@pytest.mark.parametrize("footprint", [1200]) | ||
def test_petitioner_icpe(rf, moulinette_url): | ||
eval_kwargs = { | ||
"user_type": USER_TYPES.petitioner, | ||
"is_icpe": True, | ||
"moulinette_url": moulinette_url, | ||
"send_eval_to_sponsor": False, | ||
} | ||
eval, moulinette = fake_moulinette( | ||
moulinette_url, | ||
"soumis", | ||
"non_soumis", | ||
"non_soumis", | ||
"non_soumis", | ||
**eval_kwargs, | ||
) | ||
|
||
req = rf.get("/") | ||
eval_email = eval.get_evaluation_email() | ||
email = eval_email.get_email(req) | ||
|
||
assert email.to == ["[email protected]", "[email protected]"] | ||
assert email.cc == [] | ||
assert email.bcc == [] | ||
|
||
body = email.body | ||
assert "À transmettre au porteur" not in body | ||
assert ( | ||
"Le projet semble être une Installation Classée pour la Protection de l’Environnement (ICPE)" | ||
in body | ||
) | ||
assert ( | ||
"nous n’avons pas envoyé cet avis directement au porteur, car EnvErgo ne se prononce pas encore" | ||
not in body | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.