Skip to content

Commit

Permalink
Remove old, unneeded flags
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchrisadams committed Jul 1, 2024
1 parent 268b13d commit f967574
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 61 deletions.
6 changes: 2 additions & 4 deletions apps/accounts/admin_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
from django.shortcuts import render
from django.urls import path, reverse
from django.views.generic.edit import FormView
from waffle import flag_is_active
from waffle.mixins import WaffleFlagMixin


from apps.greencheck.views import GreenUrlsView

Expand Down Expand Up @@ -89,11 +88,10 @@ def clean(self):
)


class CarbonTxtCheckView(LoginRequiredMixin, WaffleFlagMixin, FormView):
class CarbonTxtCheckView(LoginRequiredMixin, FormView):
template_name = "carbon_txt_preview.html"
form_class = CarbonTxtForm
success_url = "/admin/carbon-txt-preview"
waffle_flag = "carbon_txt_preview"

def form_valid(self, form):
"""Show the valid"""
Expand Down
4 changes: 2 additions & 2 deletions apps/accounts/templates/provider_portal/before_starting.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'base.html' %}

{% load i18n static humanize widget_tweaks tailwind_filters waffle_tags %}
{% load i18n static humanize widget_tweaks tailwind_filters %}

{% block content %}

Expand Down Expand Up @@ -38,4 +38,4 @@ <h3 class="font-bold text-xl uppercase mt-12">Ready?</h3>

</div>

{% endblock %}
{% endblock %}
6 changes: 1 addition & 5 deletions apps/accounts/tests/test_provider_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
from ..factories import ProviderRequestFactory, ProviderRequestLocationFactory
from django.test import RequestFactory
from django.urls import reverse
from waffle.testutils import override_flag


import pytest


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_portal_home_view_displays_only_authored_requests(client):
# given: 3 provider requests exist, created by different users
pr1 = ProviderRequestFactory.create()
Expand All @@ -30,7 +29,6 @@ def test_provider_portal_home_view_displays_only_authored_requests(client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_portal_home_view_returns_only_unapproved_requests(client):
# given: 1 pending verification request
pr1 = ProviderRequestFactory.create(status=ProviderRequestStatus.PENDING_REVIEW)
Expand All @@ -56,7 +54,6 @@ def test_provider_portal_home_view_returns_only_unapproved_requests(client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_portal_home_view_filters_out_removed_requests(client):
# given: 1 removed verification request
removed_request = ProviderRequestFactory.create(
Expand Down Expand Up @@ -84,7 +81,6 @@ def test_provider_portal_home_view_filters_out_removed_requests(client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_portal_home_view_items_sorted_by_name(client):
# given: 3 pending verification requests
pr1 = ProviderRequestFactory.create(status=ProviderRequestStatus.PENDING_REVIEW)
Expand Down
24 changes: 0 additions & 24 deletions apps/accounts/tests/test_provider_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ def test_staff_can_access_admin(greenweb_staff_user, client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_detail_view_accessible_by_creator(client):
# given: provider request exists
pr = ProviderRequestFactory.create()
Expand All @@ -269,7 +268,6 @@ def test_detail_view_accessible_by_creator(client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_detail_view_accessible_by_admin(client, greenweb_staff_user):
# given: provider request exists
pr = ProviderRequestFactory.create()
Expand All @@ -284,7 +282,6 @@ def test_detail_view_accessible_by_admin(client, greenweb_staff_user):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_detail_view_forbidden_for_others(client, user):
# given: provider request exists
pr = ProviderRequestFactory.create()
Expand All @@ -298,7 +295,6 @@ def test_detail_view_forbidden_for_others(client, user):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_wizard_view_happy_path(
user,
client,
Expand Down Expand Up @@ -364,7 +360,6 @@ def _create_provider_request(client, form_data) -> HttpResponse:


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_wizard_sends_email_on_submission(
user,
client,
Expand Down Expand Up @@ -940,7 +935,6 @@ def test_approve_skips_duplicate_evidence_when_existing_evidence_updated(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_wizard_view_with_just_network_explanation(
user,
client,
Expand Down Expand Up @@ -983,7 +977,6 @@ def test_wizard_view_with_just_network_explanation(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_wizard_records_if_location_import_needed(
user,
client,
Expand Down Expand Up @@ -1025,7 +1018,6 @@ def test_wizard_records_if_location_import_needed(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_new_submission_doesnt_modify_available_services(
user,
client,
Expand Down Expand Up @@ -1065,7 +1057,6 @@ def test_new_submission_doesnt_modify_available_services(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_edit_view_accessible_by_creator(client):
# given: an open provider request
pr = ProviderRequestFactory.create()
Expand All @@ -1079,7 +1070,6 @@ def test_edit_view_accessible_by_creator(client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_edit_view_accessible_by_admin(client, greenweb_staff_user):
# given: an open provider request
pr = ProviderRequestFactory.create()
Expand All @@ -1093,7 +1083,6 @@ def test_edit_view_accessible_by_admin(client, greenweb_staff_user):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_edit_view_inaccessible_by_other_users(client, user):
# given: an open provider request
pr = ProviderRequestFactory.create()
Expand All @@ -1107,7 +1096,6 @@ def test_edit_view_inaccessible_by_other_users(client, user):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
@pytest.mark.parametrize(
"request_status,status_code",
[
Expand All @@ -1130,7 +1118,6 @@ def test_edit_view_accessible_for_given_status(client, request_status, status_co


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_edit_view_displays_form_with_prepopulated_data(client):
# given: an open provider request
pr = ProviderRequestFactory.create()
Expand All @@ -1154,7 +1141,6 @@ def test_edit_view_displays_form_with_prepopulated_data(client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_editing_pr_updates_original_submission(
client,
wizard_form_org_details_data,
Expand Down Expand Up @@ -1339,7 +1325,6 @@ def test_editing_pr_updates_original_submission(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_edit_view_accessible_by_user_with_required_perms(
client, hosting_provider_with_sample_user, sample_hoster_user
):
Expand All @@ -1355,7 +1340,6 @@ def test_provider_edit_view_accessible_by_user_with_required_perms(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_edit_view_accessible_by_admins(
client, hosting_provider_with_sample_user, greenweb_staff_user
):
Expand All @@ -1371,7 +1355,6 @@ def test_provider_edit_view_accessible_by_admins(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_edit_view_inaccessible_by_unauthorized_users(
client, hosting_provider_with_sample_user
):
Expand All @@ -1390,7 +1373,6 @@ def test_provider_edit_view_inaccessible_by_unauthorized_users(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_edit_view_inaccessible_for_nonexistent_provider(client, greenweb_staff_user):
client.force_login(greenweb_staff_user)
response = client.get(urls.reverse("provider_edit", args=[str(123456)]))
Expand All @@ -1400,7 +1382,6 @@ def test_edit_view_inaccessible_for_nonexistent_provider(client, greenweb_staff_


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_editing_hp_creates_new_verification_request(
client,
hosting_provider_with_sample_user,
Expand Down Expand Up @@ -1578,7 +1559,6 @@ def test_editing_hp_creates_new_verification_request(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_saving_changes_to_verification_request_from_hp_via_wizard(
client,
hosting_provider_with_sample_user,
Expand Down Expand Up @@ -1795,7 +1775,6 @@ def test_saving_changes_to_verification_request_from_hp_via_wizard(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_saving_changes_to_hp_with_new_verification_request(
client,
hosting_provider_with_sample_user,
Expand Down Expand Up @@ -2090,7 +2069,6 @@ def test_request_from_host_provider_finishes_in_sensible_time():
),
),
)
@override_flag("provider_request", active=True)
def test_email_sent_on_approval(
hosting_provider_with_sample_user,
greenweb_staff_user,
Expand Down Expand Up @@ -2175,7 +2153,6 @@ def test_email_sent_on_approval(
),
),
)
@override_flag("provider_request", active=True)
def test_email_request_email_confirmation_is_sent(
hosting_provider_with_sample_user,
greenweb_staff_user,
Expand Down Expand Up @@ -2252,7 +2229,6 @@ def test_email_request_email_confirmation_is_sent(
("open", "Changes Requested"),
),
)
@override_flag("provider_request", active=True)
def test_staff_review_is_logged(
hosting_provider_with_sample_user,
greenweb_staff_user,
Expand Down
19 changes: 3 additions & 16 deletions apps/accounts/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging
from enum import Enum

import waffle
from dal import autocomplete
from django.conf import settings
from django.contrib import messages
Expand Down Expand Up @@ -31,7 +30,6 @@
RegistrationFormUniqueEmail,
)
from formtools.wizard.views import SessionWizardView
from waffle.mixins import WaffleFlagMixin

from .forms import (
ConsentForm,
Expand Down Expand Up @@ -63,13 +61,6 @@
class DashboardView(TemplateView):
template_name = "dashboard.html"

def get(self, request, *args, **kwargs):
if waffle.flag_is_active(request, "dashboard"):
return super().get(request, args, kwargs)
else:
return HttpResponseRedirect(reverse("provider_portal_home"))


class ProviderAutocompleteView(autocomplete.Select2QuerySetView):
def get_queryset(self):
# if a user is not authenticated don't show anything
Expand Down Expand Up @@ -176,7 +167,7 @@ def get(self, request, *args, **kwargs):
return super().get(request, args, kwargs)


class ProviderPortalHomeView(LoginRequiredMixin, WaffleFlagMixin, ListView):
class ProviderPortalHomeView(LoginRequiredMixin, ListView):
"""
Home page of the Provider Portal:
- used by external (non-staff) users to access a list of requests they submitted,
Expand All @@ -185,7 +176,6 @@ class ProviderPortalHomeView(LoginRequiredMixin, WaffleFlagMixin, ListView):
"""

template_name = "provider_portal/home.html"
waffle_flag = "provider_request"
model = ProviderRequest

def get_queryset(self) -> "dict[str, QuerySet[ProviderRequest]]":
Expand All @@ -211,7 +201,7 @@ def get_queryset(self) -> "dict[str, QuerySet[ProviderRequest]]":
}


class ProviderRequestDetailView(LoginRequiredMixin, WaffleFlagMixin, DetailView):
class ProviderRequestDetailView(LoginRequiredMixin, DetailView):
"""
Detail view for ProviderRequests:
- used by external (non-staff) users to view a summary of a single request they submitted,
Expand All @@ -220,7 +210,6 @@ class ProviderRequestDetailView(LoginRequiredMixin, WaffleFlagMixin, DetailView)
""" # noqa

template_name = "provider_portal/request_detail.html"
waffle_flag = "provider_request"
model = ProviderRequest

def get_queryset(self) -> "QuerySet[ProviderRequest]":
Expand All @@ -233,16 +222,14 @@ def get_queryset(self) -> "QuerySet[ProviderRequest]":
return ProviderRequest.objects.filter(created_by=self.request.user)


class ProviderRequestWizardView(LoginRequiredMixin, WaffleFlagMixin, SessionWizardView):
class ProviderRequestWizardView(LoginRequiredMixin, SessionWizardView):
"""
Multi-step registration for providers.
- uses `django-formtools` SessionWizardView to display
the multi-step form over multiple screens,
- requires the flag `provider_request` enabled to access the view,
"""

waffle_flag = "provider_request"
file_storage = DefaultStorage()

class Steps(Enum):
Expand Down
4 changes: 0 additions & 4 deletions apps/greencheck/tests/test_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


@pytest.mark.django_db
@override_flag("directory_listing", active=True)
def test_directory(client):
"""
Confirm that the directory view is accessible when our flag is active
Expand All @@ -18,7 +17,6 @@ def test_directory(client):


@pytest.mark.django_db
@override_flag("directory_listing", active=True)
def test_ordering_of_providers_in_directory(client, hosting_provider_factory):
"""
Check that providers are listed in order of the name of their
Expand All @@ -39,7 +37,6 @@ def test_ordering_of_providers_in_directory(client, hosting_provider_factory):


@pytest.mark.django_db
@override_flag("directory_listing", active=True)
def test_templates_in_filter_view(client, hosting_provider_factory):
"""
Check that we include the no_directoru results in our template
Expand All @@ -61,7 +58,6 @@ def test_templates_in_filter_view(client, hosting_provider_factory):


@pytest.mark.django_db
@override_flag("directory_listing", active=True)
def test_fallback_when_no_filter_view_has_no_results(client, hosting_provider_factory):
"""
Check that we include the no_directoru results in our template
Expand Down
Loading

0 comments on commit f967574

Please sign in to comment.