Remove unused request form

This commit is contained in:
Patrick Smith
2019-02-20 15:32:08 -05:00
parent c3b79103a4
commit c8a139a941
4 changed files with 0 additions and 665 deletions

View File

@@ -1,92 +0,0 @@
import pytest
from werkzeug.datastructures import ImmutableMultiDict
from atst.forms.financial import FinancialVerificationForm
from atst.domain.requests.financial_verification import PENumberValidator
@pytest.mark.parametrize(
"input_,expected",
[
("0603502N", None),
("0603502NZ", None),
("603502N", "0603502N"),
("063502N", "0603502N"),
("63502N", "0603502N"),
],
)
def test_suggest_pe_id(input_, expected):
assert PENumberValidator().suggest_pe_id(input_) == expected
def test_funding_type_other_not_required_if_funding_type_is_not_other():
form_data = ImmutableMultiDict({"legacy_task_order-funding_type": "PROC"})
form = FinancialVerificationForm(form_data)
form.validate()
assert "funding_type_other" not in form.errors
def test_funding_type_other_required_if_funding_type_is_other():
form_data = ImmutableMultiDict({"legacy_task_order-funding_type": "OTHER"})
form = FinancialVerificationForm(form_data)
form.validate()
assert "funding_type_other" in form.errors["legacy_task_order"]
@pytest.mark.parametrize(
"input_,expected",
[
("1234", True),
("123456", True),
("0001234", True),
("000123456", True),
("12345", False),
("00012345", False),
("0001234567", False),
("000000", False),
],
)
def test_treasury_code_validation(input_, expected):
form_data = ImmutableMultiDict([("request-treasury_code", input_)])
form = FinancialVerificationForm(form_data)
form.validate()
is_valid = "treasury_code" not in form.errors["request"]
assert is_valid == expected
@pytest.mark.parametrize(
"input_,expected",
[
("1", False),
("12", True),
("01", True),
("0A", False),
("A", False),
("AB", False),
("123", True),
("012", True),
("12A", True),
("02A", True),
("0012", False),
("012A", False),
("2AB", False),
],
)
def test_ba_code_validation(input_, expected):
form_data = ImmutableMultiDict([("request-ba_code", input_)])
form = FinancialVerificationForm(form_data)
form.validate()
is_valid = "ba_code" not in form.errors["request"]
assert is_valid == expected
def test_can_submit_zero_for_clin():
form_first = FinancialVerificationForm()
form_first.validate()
assert "clin_0001" in form_first.errors["legacy_task_order"]
form_data = ImmutableMultiDict([("legacy_task_order-clin_0001", "0")])
form_second = FinancialVerificationForm(form_data)
form_second.validate()
assert "clin_0001" not in form_second.errors["legacy_task_order"]

View File

@@ -1,103 +0,0 @@
import pytest
from werkzeug.datastructures import ImmutableMultiDict
from atst.forms.new_request import DetailsOfUseForm
class TestDetailsOfUseForm:
form_data = {
"dod_component": "Army and Air Force Exchange Service",
"jedi_usage": "cloud-ify all the things",
"num_software_systems": "12",
"estimated_monthly_spend": "1000000",
"dollar_value": "42",
"number_user_sessions": "6",
"average_daily_traffic": "0",
"start_date": "12/12/2050",
"name": "blue-beluga",
}
migration_data = {
"jedi_migration": "yes",
"rationalization_software_systems": "yes",
"technical_support_team": "yes",
"organization_providing_assistance": "In-house staff",
"engineering_assessment": "yes",
"data_transfers": "Less than 100GB",
"expected_completion_date": "Less than 1 month",
}
def _make_form(self, data):
form_data = ImmutableMultiDict(data.items())
return DetailsOfUseForm(form_data)
def test_require_cloud_native_when_not_migrating(self):
extra_data = {"jedi_migration": "no"}
request_form = self._make_form({**self.form_data, **extra_data})
assert not request_form.validate()
assert request_form.errors == {"cloud_native": ["Not a valid choice"]}
def test_require_migration_questions_when_migrating(self):
extra_data = {
"jedi_migration": "yes",
"data_transfers": "",
"expected_completion_date": "",
}
request_form = self._make_form({**self.form_data, **extra_data})
assert not request_form.validate()
assert request_form.errors == {
"rationalization_software_systems": ["Not a valid choice"],
"technical_support_team": ["Not a valid choice"],
"organization_providing_assistance": ["Not a valid choice"],
"engineering_assessment": ["Not a valid choice"],
"data_transfers": ["This field is required."],
"expected_completion_date": ["This field is required."],
}
def test_require_organization_when_technical_support_team(self):
data = {**self.form_data, **self.migration_data}
del data["organization_providing_assistance"]
request_form = self._make_form(data)
assert not request_form.validate()
assert request_form.errors == {
"organization_providing_assistance": ["Not a valid choice"]
}
def test_valid_form_data(self):
data = {**self.form_data, **self.migration_data}
data["technical_support_team"] = "no"
del data["organization_providing_assistance"]
request_form = self._make_form(data)
assert request_form.validate()
def test_sessions_required_for_large_applications(self):
data = {**self.form_data, **self.migration_data}
data["estimated_monthly_spend"] = "9999999"
del data["number_user_sessions"]
del data["average_daily_traffic"]
request_form = self._make_form(data)
assert not request_form.validate()
assert request_form.errors == {
"number_user_sessions": ["This field is required."],
"average_daily_traffic": ["This field is required."],
}
def test_sessions_not_required_low_monthly_spend(self):
data = {**self.form_data, **self.migration_data}
data["estimated_monthly_spend"] = "10"
del data["number_user_sessions"]
del data["average_daily_traffic"]
request_form = self._make_form(data)
assert request_form.validate()
def test_start_date_must_be_in_the_future(self):
data = {**self.form_data, **self.migration_data}
data["start_date"] = "01/01/2018"
request_form = self._make_form(data)
assert not request_form.validate()
assert "Must be a date in the future." in request_form.errors["start_date"]