Skip to content

Commit

Permalink
Merge branch 'main' into dk/1041-contact-labels
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-kennedy-ecs committed Feb 15, 2024
2 parents da30c2d + d6b1744 commit 607e81a
Show file tree
Hide file tree
Showing 34 changed files with 585 additions and 632 deletions.
2 changes: 1 addition & 1 deletion src/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi"

[packages]
django = "*"
django = "4.2.10"
cfenv = "*"
django-cors-headers = "*"
pycryptodomex = "*"
Expand Down
1,097 changes: 525 additions & 572 deletions src/Pipfile.lock

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/api/tests/test_available.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


class AvailableViewTest(MockEppLib):

"""Test that the view function works as expected."""

def setUp(self):
Expand Down Expand Up @@ -123,7 +122,6 @@ def test_error_handling(self):


class AvailableAPITest(MockEppLib):

"""Test that the API can be called as expected."""

def setUp(self):
Expand Down
1 change: 1 addition & 0 deletions src/api/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Internal API views"""

from django.apps import apps
from django.views.decorators.http import require_http_methods
from django.http import HttpResponse
Expand Down
21 changes: 21 additions & 0 deletions src/djangooidc/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,27 @@ def test_logout_redirect_url(self, mock_client):
self.assertEqual(response.status_code, 302)
self.assertEqual(actual, expected)

def test_logout_redirect_url_with_no_session_state(self, mock_client):
"""Test that logout redirects to the configured post_logout_redirect_uris."""
with less_console_noise():
# MOCK
mock_client.callback.side_effect = self.user_info
mock_client.registration_response = {"post_logout_redirect_uris": ["http://example.com/back"]}
mock_client.provider_info = {"end_session_endpoint": "http://example.com/log_me_out"}
mock_client.client_id = "TEST"
# TEST
with less_console_noise():
response = self.client.get(reverse("logout"))
# ASSERTIONS
# Assert redirect code and url are accurate
expected = (
"http://example.com/log_me_out?client_id=TEST"
"&post_logout_redirect_uri=http%3A%2F%2Fexample.com%2Fback"
)
actual = response.url
self.assertEqual(response.status_code, 302)
self.assertEqual(actual, expected)

@patch("djangooidc.views.auth_logout")
def test_logout_always_logs_out(self, mock_logout, _):
"""Without additional mocking, logout will always fail.
Expand Down
6 changes: 5 additions & 1 deletion src/djangooidc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,12 @@ def logout(request, next_page=None):
user = request.user
request_args = {
"client_id": CLIENT.client_id,
"state": request.session["state"],
}
# if state is not in request session, still redirect to the identity
# provider's logout url, but don't include the state in the url; this
# will successfully log out of the identity provider
if "state" in request.session:
request_args["state"] = request.session["state"]
if (
"post_logout_redirect_uris" in CLIENT.registration_response.keys()
and len(CLIENT.registration_response["post_logout_redirect_uris"]) > 0
Expand Down
1 change: 0 additions & 1 deletion src/registrar/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,6 @@ def __init__(self, *args, **kwargs):


class DomainApplicationAdmin(ListHeaderAdmin):

"""Custom domain applications admin class."""

class InvestigatorFilter(admin.SimpleListFilter):
Expand Down
1 change: 0 additions & 1 deletion src/registrar/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class RegistrarConfig(AppConfig):

"""Configure signal handling for our registrar Django application."""

name = "registrar"
Expand Down
1 change: 1 addition & 0 deletions src/registrar/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
```
"""

import environs
from base64 import b64decode
from cfenv import AppEnv # type: ignore
Expand Down
1 change: 0 additions & 1 deletion src/registrar/fixtures_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ def load(cls):


class DomainFixture(DomainApplicationFixture):

"""Create one domain and permissions on it for each user."""

@classmethod
Expand Down
1 change: 1 addition & 0 deletions src/registrar/management/commands/cat_files_into_getgov.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Loads files from /tmp into our sandboxes"""

import glob
import logging

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Generates current-full.csv and current-federal.csv then uploads them to the desired URL."""

import logging
import os

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Generates current-full.csv and current-federal.csv then uploads them to the desired URL."""

import logging
import os

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Loops through each valid DomainInformation object and updates its agency value"""

import argparse
import csv
import logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Not intended to be used as models but rather as an alternative to storing as a dictionary.
By keeping it as a dataclass instead of a dictionary, we can maintain data consistency.
""" # noqa

from dataclasses import dataclass, field
from datetime import date
from enum import Enum
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""""""

import csv
from dataclasses import dataclass
from datetime import datetime
Expand Down
1 change: 0 additions & 1 deletion src/registrar/models/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Contact(TimeStampedModel):

"""Contact information follows a similar pattern for each contact."""

user = models.OneToOneField(
Expand Down
3 changes: 0 additions & 3 deletions src/registrar/models/domain_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class DomainApplication(TimeStampedModel):

"""A registrant's application for a new domain."""

# Constants for choice fields
Expand Down Expand Up @@ -97,7 +96,6 @@ class StateTerritoryChoices(models.TextChoices):
ARMED_FORCES_AP = "AP", "Armed Forces Pacific (AP)"

class OrganizationChoices(models.TextChoices):

"""
Primary organization choices:
For use in django admin
Expand All @@ -114,7 +112,6 @@ class OrganizationChoices(models.TextChoices):
SCHOOL_DISTRICT = "school_district", "School district"

class OrganizationChoicesVerbose(models.TextChoices):

"""
Secondary organization choices
For use in the application form and on the templates
Expand Down
1 change: 0 additions & 1 deletion src/registrar/models/domain_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class DomainInformation(TimeStampedModel):

"""A registrant's domain information for that domain, exported from
DomainApplication. We use these field from DomainApplication with few exceptions
which are 'removed' via pop at the bottom of this file. Most of design for domain
Expand Down
2 changes: 0 additions & 2 deletions src/registrar/models/user_domain_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@


class UserDomainRole(TimeStampedModel):

"""This is a linking table that connects a user with a role on a domain."""

class Roles(models.TextChoices):

"""The possible roles are listed here.
Implementation of the named roles for allowing particular operations happens
Expand Down
1 change: 0 additions & 1 deletion src/registrar/models/verified_by_staff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class VerifiedByStaff(TimeStampedModel):

"""emails that get added to this table will bypass ial2 on login."""

email = models.EmailField(
Expand Down
1 change: 0 additions & 1 deletion src/registrar/models/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Website(TimeStampedModel):

"""Keep domain names in their own table so that applications can refer to
many of them."""

Expand Down
1 change: 0 additions & 1 deletion src/registrar/no_cache_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class NoCacheMiddleware:

"""Middleware to add a single header to every response."""

def __init__(self, get_response):
Expand Down
2 changes: 1 addition & 1 deletion src/registrar/templates/domain_add_user.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h1>Add a domain manager</h1>
<button
type="submit"
class="usa-button"
>Add a domain manager</button>
>Add domain manager</button>
</form>

{% endblock %} {# domain_content #}
1 change: 1 addition & 0 deletions src/registrar/templatetags/field_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom field helpers for our inputs."""

import re

from django import template
Expand Down
2 changes: 0 additions & 2 deletions src/registrar/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,6 @@ def test_approval_creates_role(self):


class TestDomainInformation(TestCase):

"""Test the DomainInformation model, when approved or otherwise"""

def setUp(self):
Expand Down Expand Up @@ -683,7 +682,6 @@ def clean_dict(self, dict_obj):


class TestInvitations(TestCase):

"""Test the retrieval of invitations."""

def setUp(self):
Expand Down
1 change: 1 addition & 0 deletions src/registrar/tests/test_models_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This file tests the various ways in which the registrar interacts with the registry.
"""

from django.test import TestCase
from django.db.utils import IntegrityError
from unittest.mock import MagicMock, patch, call
Expand Down
1 change: 0 additions & 1 deletion src/registrar/tests/test_views_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@


class DomainApplicationTests(TestWithUser, WebTest):

"""Webtests for domain application to test filling and submitting."""

# Doesn't work with CSRF checking
Expand Down
1 change: 0 additions & 1 deletion src/registrar/tests/test_views_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,6 @@ def test_domain_overview_blocked_for_ineligible_user(self):


class TestDomainDNSSEC(TestDomainOverview):

"""MockEPPLib is already inherited."""

def test_dnssec_page_refreshes_enable_button(self):
Expand Down
1 change: 0 additions & 1 deletion src/registrar/utility/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class EmailSendingError(RuntimeError):

"""Local error for handling all failures when sending email."""

pass
Expand Down
1 change: 0 additions & 1 deletion src/registrar/views/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def form_invalid(self, form):


class DomainView(DomainBaseView):

"""Domain detail overview page."""

template_name = "domain_detail.html"
Expand Down
7 changes: 0 additions & 7 deletions src/registrar/views/utility/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ def get_submitter(self, obj):


class PermissionsLoginMixin(PermissionRequiredMixin):

"""Mixin that redirects to login page if not logged in, otherwise 403."""

def handle_no_permission(self):
Expand All @@ -155,7 +154,6 @@ def handle_no_permission(self):


class DomainPermission(PermissionsLoginMixin):

"""Permission mixin that redirects to domain if user has access,
otherwise 403"""

Expand Down Expand Up @@ -264,7 +262,6 @@ def can_access_other_user_domains(self, pk):


class DomainApplicationPermission(PermissionsLoginMixin):

"""Permission mixin that redirects to domain application if user
has access, otherwise 403"""

Expand All @@ -287,7 +284,6 @@ def has_permission(self):


class UserDeleteDomainRolePermission(PermissionsLoginMixin):

"""Permission mixin for UserDomainRole if user
has access, otherwise 403"""

Expand Down Expand Up @@ -324,7 +320,6 @@ def has_permission(self):


class DomainApplicationPermissionWithdraw(PermissionsLoginMixin):

"""Permission mixin that redirects to withdraw action on domain application
if user has access, otherwise 403"""

Expand All @@ -347,7 +342,6 @@ def has_permission(self):


class ApplicationWizardPermission(PermissionsLoginMixin):

"""Permission mixin that redirects to start or edit domain application if
user has access, otherwise 403"""

Expand All @@ -365,7 +359,6 @@ def has_permission(self):


class DomainInvitationPermission(PermissionsLoginMixin):

"""Permission mixin that redirects to domain invitation if user has
access, otherwise 403"
Expand Down
Loading

0 comments on commit 607e81a

Please sign in to comment.