mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 10:28:41 -04:00
Refactor code after rebase
This commit is contained in:
@@ -55,11 +55,8 @@ from app.notify_client.organisations_client import OrganisationsClient
|
|||||||
from app.notify_client.models import AnonymousUser
|
from app.notify_client.models import AnonymousUser
|
||||||
from app.notify_client.letter_jobs_client import LetterJobsClient
|
from app.notify_client.letter_jobs_client import LetterJobsClient
|
||||||
from app.utils import get_cdn_domain
|
from app.utils import get_cdn_domain
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
from app.utils import gmt_timezones
|
from app.utils import gmt_timezones
|
||||||
=======
|
|
||||||
>>>>>>> Update emails to use logos cdn
|
|
||||||
|
|
||||||
login_manager = LoginManager()
|
login_manager = LoginManager()
|
||||||
csrf = CSRFProtect()
|
csrf = CSRFProtect()
|
||||||
|
|||||||
@@ -1,21 +1,14 @@
|
|||||||
import re
|
import re
|
||||||
import csv
|
import csv
|
||||||
<<<<<<< HEAD
|
|
||||||
import pytz
|
import pytz
|
||||||
=======
|
|
||||||
from datetime import datetime, timedelta, timezone
|
|
||||||
>>>>>>> Update emails to use logos cdn
|
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from os import path
|
from os import path
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
import unicodedata
|
import unicodedata
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
<<<<<<< HEAD
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from dateutil import parser
|
from dateutil import parser
|
||||||
=======
|
|
||||||
>>>>>>> Update emails to use logos cdn
|
|
||||||
|
|
||||||
import dateutil
|
import dateutil
|
||||||
import ago
|
import ago
|
||||||
@@ -337,7 +330,6 @@ def email_or_sms_not_enabled(template_type, permissions):
|
|||||||
return (template_type in ['email', 'sms']) and (template_type not in permissions)
|
return (template_type in ['email', 'sms']) and (template_type not in permissions)
|
||||||
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
def get_letter_timings(upload_time):
|
def get_letter_timings(upload_time):
|
||||||
|
|
||||||
LetterTimings = namedtuple(
|
LetterTimings = namedtuple(
|
||||||
@@ -375,8 +367,6 @@ def gmt_timezones(date):
|
|||||||
return forced_utc.astimezone(pytz.timezone('Europe/London'))
|
return forced_utc.astimezone(pytz.timezone('Europe/London'))
|
||||||
|
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> Update emails to use logos cdn
|
|
||||||
def get_cdn_domain():
|
def get_cdn_domain():
|
||||||
parsed_uri = urlparse(current_app.config['ADMIN_BASE_URL'])
|
parsed_uri = urlparse(current_app.config['ADMIN_BASE_URL'])
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,4 @@ notifications-python-client==4.3.1
|
|||||||
awscli>=1.11,<1.12
|
awscli>=1.11,<1.12
|
||||||
awscli-cwlogs>=1.4,<1.5
|
awscli-cwlogs>=1.4,<1.5
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
git+https://github.com/alphagov/notifications-utils.git@17.7.0#egg=notifications-utils==17.7.0
|
git+https://github.com/alphagov/notifications-utils.git@17.7.0#egg=notifications-utils==17.7.0
|
||||||
=======
|
|
||||||
git+https://github.com/alphagov/notifications-utils.git@17.5.5#egg=notifications-utils==17.5.5
|
|
||||||
>>>>>>> Add org select and manage pages
|
|
||||||
|
|||||||
@@ -113,18 +113,18 @@ def test_manage_orgs_shows_correct_org_info(request_get_manage_org_with_org):
|
|||||||
|
|
||||||
|
|
||||||
def test_manage_orgs_does_not_show_data_for_new_org(request_get_manage_org_without_org):
|
def test_manage_orgs_does_not_show_data_for_new_org(request_get_manage_org_without_org):
|
||||||
assert request_get_manage_org_without_org.select_one('div.page-footer > input.button').has_attr('disabled')
|
assert request_get_manage_org_without_org.select_one('div.page-footer input.button').has_attr('disabled')
|
||||||
assert request_get_manage_org_without_org.select_one('#logo-img > img') is None
|
assert request_get_manage_org_without_org.select_one('#logo-img > img') is None
|
||||||
assert request_get_manage_org_without_org.select_one('#name').attrs.get('value') == ''
|
assert request_get_manage_org_without_org.select_one('#name').attrs.get('value') == ''
|
||||||
assert request_get_manage_org_without_org.select_one('#colour').attrs.get('value') == ''
|
assert request_get_manage_org_without_org.select_one('#colour').attrs.get('value') == ''
|
||||||
|
|
||||||
|
|
||||||
def test_save_is_enabled_when_logo_is_set(request_get_manage_org_with_org):
|
def test_save_is_enabled_when_logo_is_set(request_get_manage_org_with_org):
|
||||||
assert request_get_manage_org_with_org.select_one('div.page-footer > input.button').has_attr('disabled') is False
|
assert request_get_manage_org_with_org.select_one('div.page-footer input.button').has_attr('disabled') is False
|
||||||
|
|
||||||
|
|
||||||
def test_save_is_disabled_when_logo_is_not_set(request_get_manage_org_without_org):
|
def test_save_is_disabled_when_logo_is_not_set(request_get_manage_org_without_org):
|
||||||
assert request_get_manage_org_without_org.select_one('div.page-footer > input.button').has_attr('disabled')
|
assert request_get_manage_org_without_org.select_one('div.page-footer input.button').has_attr('disabled')
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@@ -157,7 +157,7 @@ def test_shows_temp_logo_after_uploading_logo(request_post_manage_org_redirect):
|
|||||||
|
|
||||||
def test_save_enabled_after_uploading_logo(request_post_manage_org_redirect):
|
def test_save_enabled_after_uploading_logo(request_post_manage_org_redirect):
|
||||||
page, _ = request_post_manage_org_redirect
|
page, _ = request_post_manage_org_redirect
|
||||||
assert not page.select_one('div.page-footer > input.button').has_attr('disabled')
|
assert not page.select_one('div.page-footer input.button').has_attr('disabled')
|
||||||
|
|
||||||
|
|
||||||
def test_deletes_previous_temp_logo_after_uploading_logo(logged_in_platform_admin_client, mocker, fake_uuid):
|
def test_deletes_previous_temp_logo_after_uploading_logo(logged_in_platform_admin_client, mocker, fake_uuid):
|
||||||
|
|||||||
@@ -156,8 +156,6 @@ def test_generate_notifications_csv_calls_twice_if_next_link(mocker):
|
|||||||
assert mock_get_notifications.mock_calls[1][2]['page'] == 2
|
assert mock_get_notifications.mock_calls[1][2]['page'] == 2
|
||||||
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
@freeze_time('2017-07-14 14:59:59') # Friday, before print deadline
|
@freeze_time('2017-07-14 14:59:59') # Friday, before print deadline
|
||||||
@pytest.mark.parametrize('upload_time, expected_print_time, is_printed, expected_earliest, expected_latest', [
|
@pytest.mark.parametrize('upload_time, expected_print_time, is_printed, expected_earliest, expected_latest', [
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user