-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FS-4895: When creating a fund or a round check, whether given round s…
…hortnames are available
- Loading branch information
1 parent
6541583
commit 90740d6
Showing
5 changed files
with
180 additions
and
66 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
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
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 |
---|---|---|
|
@@ -81,6 +81,38 @@ def test_create_fund(flask_test_client): | |
assert created_fund.__getattribute__(key) == value | ||
|
||
|
||
@pytest.mark.usefixtures("set_auth_cookie", "patch_validate_token_rs256_internal_user") | ||
def test_create_fund_with_existing_short_name(flask_test_client): | ||
""" | ||
Tests that a fund can be successfully created using the /fund route | ||
Verifies that the created fund has the correct attributes | ||
""" | ||
create_data = { | ||
"name_en": "New Fund 2", | ||
"title_en": "New Fund Title 2", | ||
"description_en": "New Fund Description 2", | ||
"welsh_available": "false", | ||
"short_name": "SMP1", | ||
"funding_type": FundingType.COMPETITIVE.value, | ||
"ggis_scheme_reference_number": "G1-SCH-0000092415", | ||
} | ||
response = submit_form(flask_test_client, "/fund", create_data) | ||
assert response.status_code == 200 | ||
create_data = { | ||
"name_en": "New Fund 3", | ||
"title_en": "New Fund Title 3", | ||
"description_en": "New Fund Description 3", | ||
"welsh_available": "false", | ||
"short_name": "SMP1", | ||
"funding_type": FundingType.COMPETITIVE.value, | ||
"ggis_scheme_reference_number": "G1-SCH-0000092415", | ||
} | ||
response = submit_form(flask_test_client, "/fund", create_data) | ||
assert response.status_code == 200 | ||
html = response.data.decode('utf-8') | ||
assert '<a href="#short_name">Given fund short name already exists.</a>' in html, "Not having the fund short name already exists error" | ||
|
||
|
||
@pytest.mark.usefixtures("set_auth_cookie", "patch_validate_token_rs256_internal_user") | ||
def test_update_fund(flask_test_client, seed_dynamic_data): | ||
""" | ||
|
@@ -115,6 +147,66 @@ def test_update_fund(flask_test_client, seed_dynamic_data): | |
elif key != "submit": | ||
assert updated_fund.__getattribute__(key) == value | ||
|
||
@pytest.mark.usefixtures("set_auth_cookie", "patch_validate_token_rs256_internal_user") | ||
def test_create_round_with_existing_short_name(flask_test_client, seed_dynamic_data): | ||
""" | ||
Tests that a round can be successfully created using the /round route | ||
Verifies that the created round has the correct attributes | ||
""" | ||
test_fund = seed_dynamic_data["funds"][0] | ||
new_round_data = { | ||
"fund_id": test_fund.fund_id, | ||
"title_en": "New Round", | ||
"short_name": "NR123", | ||
"opens-day": "01", | ||
"opens-month": "10", | ||
"opens-year": "2024", | ||
"opens-hour": "09", | ||
"opens-minute": "00", | ||
"deadline-day": "01", | ||
"deadline-month": "12", | ||
"deadline-year": "2024", | ||
"deadline-hour": "17", | ||
"deadline-minute": "00", | ||
"assessment_start-day": "02", | ||
"assessment_start-month": "12", | ||
"assessment_start-year": "2024", | ||
"assessment_start-hour": "09", | ||
"assessment_start-minute": "00", | ||
"reminder_date-day": "15", | ||
"reminder_date-month": "11", | ||
"reminder_date-year": "2024", | ||
"reminder_date-hour": "09", | ||
"reminder_date-minute": "00", | ||
"assessment_deadline-day": "15", | ||
"assessment_deadline-month": "12", | ||
"assessment_deadline-year": "2024", | ||
"assessment_deadline-hour": "17", | ||
"assessment_deadline-minute": "00", | ||
"prospectus_link": "http://example.com/prospectus", | ||
"privacy_notice_link": "http://example.com/privacy", | ||
"contact_email": "[email protected]", | ||
"submit": "Submit", | ||
"contact_phone": "1234567890", | ||
"contact_textphone": "0987654321", | ||
"support_times": "9am - 5pm", | ||
"support_days": "Monday to Friday", | ||
"feedback_link": "http://example.com/feedback", | ||
"project_name_field_id": 1, | ||
"guidance_url": "http://example.com/guidance", | ||
} | ||
|
||
response = submit_form(flask_test_client, "/round", new_round_data) | ||
assert response.status_code == 200 | ||
new_round_data = {**new_round_data, 'short_name': 'NR1234'} | ||
response = submit_form(flask_test_client, "/round", new_round_data) | ||
assert response.status_code == 200 | ||
new_round_data = {**new_round_data, 'short_name': 'NR123'} | ||
response = submit_form(flask_test_client, "/round", new_round_data) | ||
assert response.status_code == 200 | ||
html = response.data.decode('utf-8') | ||
assert '<a href="#short_name">Given short name already exists in the fund funding to improve testing.</a>' in html, "Not having the fund round short name already exists error" | ||
|
||
|
||
@pytest.mark.usefixtures("set_auth_cookie", "patch_validate_token_rs256_internal_user") | ||
def test_create_new_round(flask_test_client, seed_dynamic_data): | ||
|