added validation tests and removed span error message
This commit is contained in:
parent
c98261503e
commit
6a5524a8b8
2 changed files with 14 additions and 5 deletions
|
|
@ -317,7 +317,6 @@
|
|||
<div class="col-sm-6"><input type="number" id="infected_people" class="form-control" name="infected_people" min=1 value=1 required></div>
|
||||
</div>
|
||||
|
||||
<span id="training_limit_error" class="red_text" hidden>Conference/Training activities limited to 1 infected<br></span>
|
||||
<hr width="80%">
|
||||
|
||||
<div class="form-group row">
|
||||
|
|
|
|||
|
|
@ -167,10 +167,20 @@ def test_ventilation_window_hepa(baseline_form: model_generator.FormData):
|
|||
assert ventilation == baseline_vent
|
||||
|
||||
|
||||
def test_infected_less_than_total_people(baseline_form: model_generator.FormData):
|
||||
baseline_form.total_people = 10
|
||||
baseline_form.infected_people = 11
|
||||
with pytest.raises(ValueError, match='Number of infected people cannot be more than number of total people.'):
|
||||
@pytest.mark.parametrize(
|
||||
["activity", "total_people", "infected_people", "error"],
|
||||
[
|
||||
['office', 10, 11, "Number of infected people cannot be more or equal than number of total people."],
|
||||
['office', 10, 10, "Number of infected people cannot be more or equal than number of total people."],
|
||||
['training', 10, 2, "Conference/Training activities are limited to 1 infected."],
|
||||
]
|
||||
)
|
||||
def test_infected_less_than_total_people(activity, total_people, infected_people, error,
|
||||
baseline_form: model_generator.FormData):
|
||||
baseline_form.activity_type = activity
|
||||
baseline_form.total_people = total_people
|
||||
baseline_form.infected_people = infected_people
|
||||
with pytest.raises(ValueError, match=error):
|
||||
baseline_form.validate()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue