Skip to content

Commit

Permalink
Merge pull request #416 from praekeltfoundation/consistent-labels
Browse files Browse the repository at this point in the history
Fix class_name warning
  • Loading branch information
erikh360 authored Feb 13, 2025
2 parents bc637b3 + 55c1467 commit 200d70e
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add locale filtering to assessments API
- Error message when list_items is broken
- Consistent labelling on import forms
- Fix class_name warning: RemovedInWagtail60Warning
### Removed
- Locale field on exports
-->
Expand Down
2 changes: 1 addition & 1 deletion contentrepo/templates/assessment_upload.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="col header-title">
{% block h1 %}
<h1>
{% icon name="openquote" class_name="header-title-icon" %}
{% icon name="openquote" classname="header-title-icon" %}
{% if loading %}
{% trans 'Uploading Content...' %}
{% else %}
Expand Down
2 changes: 1 addition & 1 deletion contentrepo/templates/whatsapptemplate_upload.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="col header-title">
{% block h1 %}
<h1>
{% icon name="openquote" class_name="header-title-icon" %}
{% icon name="openquote" classname="header-title-icon" %}
{% if loading %}
{% trans 'Uploading Content...' %}
{% else %}
Expand Down
68 changes: 68 additions & 0 deletions home/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,74 @@ def test_ordered_form_has_all_expected_options(self, admin_client):
assert find_options(soup, "purge") == ["No", "Yes"]


class TestAssessmentImportView:
def test_import_assessment(self, admin_client):
"""
The import page can be accessed at the expected url
"""
response = admin_client.get("/admin/import_assessment/")

assert response.status_code == status.HTTP_200_OK
asserts.assertContains(response, "Upload Content")

def test_assessment_form_has_all_expected_options(self, admin_client):
"""
The upload form has all expected options:
- heading
- file upload field
- csv and Excel file as file type options in a drop down
- Yes and No as purge options in a drop down
- All current locale and each locale as an option for the languages
"""
response = admin_client.get("/admin/import_assessment/")
soup = BeautifulSoup(response.content, "html.parser")

heading = soup.find("h1").text.strip()
assert heading == "Upload Content"

form = soup.find("form")
file_upload = form.find("input", type="file", id="id_file")
assert file_upload

assert find_options(form, "file_type") == ["CSV File", "Excel File"]
assert find_options(soup, "purge") == ["No", "Yes"]
assert find_options(form, "locale") == ["Import all languages", "English"]


class TestWhatsAppTemplateImportView:
def test_import_whatsapp_template(self, admin_client):
"""
The import page can be accessed at the expected url
"""
response = admin_client.get("/admin/import_whatsapptemplate/")

assert response.status_code == status.HTTP_200_OK
asserts.assertContains(response, "Upload Content")

def test_whatsapp_template_form_has_all_expected_options(self, admin_client):
"""
The upload form has all expected options:
- heading
- file upload field
- csv and Excel file as file type options in a drop down
- Yes and No as purge options in a drop down
- All current locale and each locale as an option for the languages
"""
response = admin_client.get("/admin/import_whatsapptemplate/")
soup = BeautifulSoup(response.content, "html.parser")

heading = soup.find("h1").text.strip()
assert heading == "Upload Content"

form = soup.find("form")
file_upload = form.find("input", type="file", id="id_file")
assert file_upload

assert find_options(form, "file_type") == ["CSV File", "Excel File"]
assert find_options(soup, "purge") == ["No", "Yes"]
assert find_options(form, "locale") == ["Import all languages", "English"]


@pytest.mark.django_db
class TestPageViewReportView:
def create_content_page(self, number_of_pages):
Expand Down

0 comments on commit 200d70e

Please sign in to comment.