mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
define isort first party (app and tests)
we were seeing isort produce different outputs locally and in docker - this was due to it having different opinions about whether the tests module (ie all our unit tests) is a first party (local) or third party (pip installed) import. It's a first party import, so by defining this in the setup.cfg isort settings, we can force it to be consistent between environments. Note: I don't know why it was different in the first place though
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import pytest
|
||||
|
||||
from tests.conftest import set_config_values
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import pytest
|
||||
from flask import url_for
|
||||
|
||||
from tests.conftest import normalize_spaces
|
||||
|
||||
SAMPLE_DATA = {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import pytest
|
||||
from flask import url_for
|
||||
from tests import user_json
|
||||
|
||||
from app.notify_client.models import User
|
||||
from tests import user_json
|
||||
|
||||
|
||||
def user_with_orgs_and_services(num_orgs, num_services, platform_admin=False):
|
||||
|
||||
@@ -5,9 +5,9 @@ import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
from notifications_python_client.errors import HTTPError
|
||||
from tests.conftest import ORGANISATION_ID, normalize_spaces
|
||||
|
||||
from app.notify_client.models import InvitedOrgUser
|
||||
from tests.conftest import ORGANISATION_ID, normalize_spaces
|
||||
|
||||
|
||||
def test_organisation_page_shows_all_organisations(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from flask import url_for
|
||||
|
||||
from tests.conftest import normalize_spaces
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import functools
|
||||
|
||||
import pytest
|
||||
from flask import url_for
|
||||
|
||||
from tests.conftest import client_request as client_request_factory
|
||||
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ from unittest.mock import ANY, Mock
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
from notifications_python_client.errors import HTTPError
|
||||
from tests.conftest import mock_check_invite_token as mock_check_token_invite
|
||||
from tests.conftest import normalize_spaces
|
||||
from tests.conftest import sample_invite as create_sample_invite
|
||||
|
||||
import app
|
||||
from app.notify_client.models import InvitedUser
|
||||
from tests.conftest import mock_check_invite_token as mock_check_token_invite
|
||||
from tests.conftest import normalize_spaces
|
||||
from tests.conftest import sample_invite as create_sample_invite
|
||||
|
||||
|
||||
def test_existing_user_accept_invite_calls_api_and_redirects_to_dashboard(
|
||||
|
||||
@@ -6,14 +6,14 @@ import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
from freezegun import freeze_time
|
||||
|
||||
from app.main.views.jobs import get_status_filters, get_time_left
|
||||
from tests.conftest import (
|
||||
SERVICE_ONE_ID,
|
||||
mock_get_notifications,
|
||||
normalize_spaces,
|
||||
)
|
||||
|
||||
from app.main.views.jobs import get_status_filters, get_time_left
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"message_type,page_title", [
|
||||
|
||||
@@ -2,6 +2,7 @@ from io import BytesIO
|
||||
|
||||
import pytest
|
||||
from flask import url_for
|
||||
|
||||
from tests.conftest import active_user_with_permissions
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ from unittest.mock import call
|
||||
import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
|
||||
from tests import validate_route_permission
|
||||
from tests.conftest import (
|
||||
SERVICE_ONE_ID,
|
||||
|
||||
@@ -5,14 +5,14 @@ import pytest
|
||||
from flask import url_for
|
||||
from freezegun import freeze_time
|
||||
from notifications_python_client.errors import HTTPError
|
||||
|
||||
from app.main.views.conversation import get_user_number
|
||||
from tests.conftest import (
|
||||
SERVICE_ONE_ID,
|
||||
mock_get_notifications,
|
||||
normalize_spaces,
|
||||
)
|
||||
|
||||
from app.main.views.conversation import get_user_number
|
||||
|
||||
|
||||
def test_get_user_phone_number_when_only_inbound_exists(mocker):
|
||||
|
||||
|
||||
@@ -8,6 +8,15 @@ import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
from freezegun import freeze_time
|
||||
|
||||
from app.main.views.dashboard import (
|
||||
aggregate_status_types,
|
||||
format_monthly_stats_to_list,
|
||||
format_template_stats_to_list,
|
||||
get_dashboard_totals,
|
||||
get_free_paid_breakdown_for_billable_units,
|
||||
get_tuples_of_financial_years,
|
||||
)
|
||||
from tests import (
|
||||
validate_route_permission,
|
||||
validate_route_permission_with_client,
|
||||
@@ -19,15 +28,6 @@ from tests.conftest import (
|
||||
normalize_spaces,
|
||||
)
|
||||
|
||||
from app.main.views.dashboard import (
|
||||
aggregate_status_types,
|
||||
format_monthly_stats_to_list,
|
||||
format_template_stats_to_list,
|
||||
get_dashboard_totals,
|
||||
get_free_paid_breakdown_for_billable_units,
|
||||
get_tuples_of_financial_years,
|
||||
)
|
||||
|
||||
stub_template_stats = [
|
||||
{
|
||||
'template_type': 'sms',
|
||||
|
||||
@@ -4,9 +4,9 @@ from unittest.mock import call
|
||||
import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
from tests.conftest import mock_get_email_branding, normalize_spaces
|
||||
|
||||
from app.main.s3_client import LOGO_LOCATION_STRUCTURE, TEMP_TAG
|
||||
from tests.conftest import mock_get_email_branding, normalize_spaces
|
||||
|
||||
|
||||
def test_email_branding_page_shows_full_branding_list(
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import pytest
|
||||
from flask import Response, url_for
|
||||
from notifications_python_client.errors import HTTPError
|
||||
from tests.conftest import api_user_active as create_active_user
|
||||
|
||||
import app
|
||||
from tests.conftest import api_user_active as create_active_user
|
||||
|
||||
|
||||
def test_should_render_forgot_password(client):
|
||||
|
||||
@@ -3,6 +3,7 @@ from functools import partial
|
||||
import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
|
||||
from tests.conftest import active_user_with_permissions, normalize_spaces
|
||||
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@ import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
from freezegun import freeze_time
|
||||
|
||||
from app.main.views.jobs import get_time_left
|
||||
from tests.conftest import (
|
||||
SERVICE_ONE_ID,
|
||||
mock_get_notifications,
|
||||
normalize_spaces,
|
||||
)
|
||||
|
||||
from app.main.views.jobs import get_time_left
|
||||
|
||||
|
||||
def test_get_jobs_should_return_list_of_all_real_jobs(
|
||||
logged_in_client,
|
||||
|
||||
@@ -3,6 +3,10 @@ import copy
|
||||
import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
|
||||
import app
|
||||
from app.notify_client.models import InvitedUser
|
||||
from app.utils import is_gov_user
|
||||
from tests.conftest import (
|
||||
SERVICE_ONE_ID,
|
||||
active_user_manage_template_permission,
|
||||
@@ -13,10 +17,6 @@ from tests.conftest import (
|
||||
)
|
||||
from tests.conftest import service_one as create_sample_service
|
||||
|
||||
import app
|
||||
from app.notify_client.models import InvitedUser
|
||||
from app.utils import is_gov_user
|
||||
|
||||
|
||||
@pytest.mark.parametrize('user, expected_self_text, expected_coworker_text', [
|
||||
(
|
||||
|
||||
@@ -6,6 +6,7 @@ import pytest
|
||||
from flask import url_for
|
||||
from freezegun import freeze_time
|
||||
from notifications_python_client.errors import APIError
|
||||
|
||||
from tests.conftest import (
|
||||
SERVICE_ONE_ID,
|
||||
mock_get_notification,
|
||||
|
||||
@@ -4,14 +4,14 @@ from unittest.mock import ANY
|
||||
import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
from tests import service_json
|
||||
from tests.conftest import mock_get_user, normalize_spaces
|
||||
|
||||
from app.main.views.platform_admin import (
|
||||
create_global_stats,
|
||||
format_stats_by_service,
|
||||
sum_service_usage,
|
||||
)
|
||||
from tests import service_json
|
||||
from tests.conftest import mock_get_user, normalize_spaces
|
||||
|
||||
|
||||
@pytest.mark.parametrize('endpoint', [
|
||||
|
||||
@@ -16,6 +16,14 @@ from notifications_utils.template import (
|
||||
LetterImageTemplate,
|
||||
LetterPreviewTemplate,
|
||||
)
|
||||
from xlrd.biffh import XLRDError
|
||||
from xlrd.xldate import (
|
||||
XLDateAmbiguous,
|
||||
XLDateError,
|
||||
XLDateNegative,
|
||||
XLDateTooLarge,
|
||||
)
|
||||
|
||||
from tests import (
|
||||
validate_route_permission,
|
||||
validate_route_permission_with_client,
|
||||
@@ -38,13 +46,6 @@ from tests.conftest import (
|
||||
no_sms_senders,
|
||||
normalize_spaces,
|
||||
)
|
||||
from xlrd.biffh import XLRDError
|
||||
from xlrd.xldate import (
|
||||
XLDateAmbiguous,
|
||||
XLDateError,
|
||||
XLDateNegative,
|
||||
XLDateTooLarge,
|
||||
)
|
||||
|
||||
template_types = ['email', 'sms']
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@ import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
from freezegun import freeze_time
|
||||
|
||||
import app
|
||||
from app.utils import email_safe
|
||||
from tests import service_json, validate_route_permission
|
||||
from tests.conftest import (
|
||||
SERVICE_ONE_ID,
|
||||
@@ -28,9 +31,6 @@ from tests.conftest import (
|
||||
platform_admin_user,
|
||||
)
|
||||
|
||||
import app
|
||||
from app.utils import email_safe
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_get_service_settings_page_common(
|
||||
|
||||
@@ -6,6 +6,11 @@ from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
from freezegun import freeze_time
|
||||
from notifications_python_client.errors import HTTPError
|
||||
|
||||
from app.main.views.templates import (
|
||||
get_human_readable_delta,
|
||||
get_last_use_message,
|
||||
)
|
||||
from tests import (
|
||||
single_notification_json,
|
||||
template_json,
|
||||
@@ -22,11 +27,6 @@ from tests.conftest import (
|
||||
from tests.conftest import service_one as create_sample_service
|
||||
from tests.conftest import single_letter_contact_block
|
||||
|
||||
from app.main.views.templates import (
|
||||
get_human_readable_delta,
|
||||
get_last_use_message,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('extra_args, expected_nav_links, expected_templates', [
|
||||
(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
|
||||
from tests.conftest import SERVICE_ONE_ID, normalize_spaces, set_config
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import uuid
|
||||
import pytest
|
||||
from flask import url_for
|
||||
from notifications_utils.url_safe_token import generate_token
|
||||
|
||||
from tests.conftest import api_user_active as create_user
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import uuid
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
from itsdangerous import SignatureExpired
|
||||
|
||||
from tests.conftest import normalize_spaces
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import uuid
|
||||
|
||||
import pytest
|
||||
from tests import notification_json, single_notification_json
|
||||
|
||||
from app.notify_client.notification_api_client import NotificationApiClient
|
||||
from tests import notification_json, single_notification_json
|
||||
|
||||
|
||||
@pytest.mark.parametrize("arguments,expected_call", [
|
||||
|
||||
@@ -3,10 +3,10 @@ from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import werkzeug
|
||||
from tests import service_json
|
||||
from tests.conftest import api_user_active, platform_admin_user, set_config
|
||||
|
||||
from app.notify_client import NotifyAdminAPIClient
|
||||
from tests import service_json
|
||||
from tests.conftest import api_user_active, platform_admin_user, set_config
|
||||
|
||||
SAMPLE_API_KEY = '{}-{}'.format('a' * 36, 's' * 36)
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from unittest.mock import call
|
||||
|
||||
import pytest
|
||||
from tests.conftest import SERVICE_ONE_ID, fake_uuid
|
||||
|
||||
from app import invite_api_client, service_api_client, user_api_client
|
||||
from app.notify_client.service_api_client import ServiceAPIClient
|
||||
from tests.conftest import SERVICE_ONE_ID, fake_uuid
|
||||
|
||||
FAKE_TEMPLATE_ID = fake_uuid()
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from unittest.mock import call
|
||||
|
||||
import pytest
|
||||
from tests.conftest import SERVICE_ONE_ID, api_user_pending, fake_uuid
|
||||
|
||||
from app import invite_api_client, service_api_client, user_api_client
|
||||
from app.notify_client.models import User
|
||||
from tests.conftest import SERVICE_ONE_ID, api_user_pending, fake_uuid
|
||||
|
||||
user_id = fake_uuid()
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from freezegun import freeze_time
|
||||
from tests.conftest import fake_uuid
|
||||
|
||||
from app import format_datetime_relative
|
||||
from app.utils import (
|
||||
@@ -18,6 +17,7 @@ from app.utils import (
|
||||
get_cdn_domain,
|
||||
get_letter_timings,
|
||||
)
|
||||
from tests.conftest import fake_uuid
|
||||
|
||||
|
||||
def _get_notifications_csv(
|
||||
|
||||
Reference in New Issue
Block a user