from directory_constants.helpers import UrlString, get_url from directory_constants.urls.domestic import INTERNATIONAL_CONTACT_TRIAGE HOME = UrlString( get_url('DIRECTORY_CONSTANTS_URL_INTERNATIONAL', 'https://great.gov.uk/international/')) CONTENT_ROOT = HOME / 'content' # about the UK ABOUT_UK_HOME = CONTENT_ROOT / 'about-uk' ABOUT_UK_WHY_CHOOSE_UK = ABOUT_UK_HOME / 'why-choose-uk' ABOUT_UK_INDUSTRIES = CONTENT_ROOT / 'industries' ABOUT_UK_REGIONS = ABOUT_UK_HOME / 'regions' ABOUT_UK_CONTACT = INTERNATIONAL_CONTACT_TRIAGE # expand expand_slug = get_url('DIRECTORY_CONSTANTS_EXPAND_SLUG', 'invest') # for the transition from invest/ to expand/ EXPAND_HOME = HOME / expand_slug EXPAND_CONTENT_ROOT = CONTENT_ROOT / expand_slug EXPAND_HOW_TO_SETUP = CONTENT_ROOT / 'how-to-setup-in-the-uk' EXPAND_HOW_TO_SETUP_VISAS_AND_MIGRATION = EXPAND_HOW_TO_SETUP / 'uk-visas-and-migration' EXPAND_HOW_TO_SETUP_TAX_AND_INCENTIVES = EXPAND_HOW_TO_SETUP / 'uk-tax-and-incentives' EXPAND_HOW_TO_DO_BUSINESS = CONTENT_ROOT / 'how-to-do-business-with-the-uk' EXPAND_HOW_WE_HELP = EXPAND_CONTENT_ROOT / 'how-we-help-you-expand' EXPAND_CONTACT = EXPAND_HOME / 'contact' # capital invest CAPITAL_INVEST_HOME = CONTENT_ROOT / 'capital-invest' CAPITAL_INVEST_OPPORTUNITIES = CONTENT_ROOT / 'opportunities' CAPITAL_INVEST_HOW_WE_HELP = CAPITAL_INVEST_HOME / 'how-we-help-you-invest-capital'
'site_section': 'Articles', 'site_subsection': 'TagList', }, 'NewsList': { 'site_section': 'Articles', 'site_subsection': 'BrexitNews', } } def get_ga_data_for_page(page_type): return GA_DATA_MAPPING[page_type] build_great_international_url = partial( urljoin, get_url('DIRECTORY_CONSTANTS_URL_INTERNATIONAL', 'https://great.gov.uk/international/') ) def company_profile_retrieve(sso_session_id): response = api_client.company.profile_retrieve(sso_session_id) if response.status_code == 404: return None response.raise_for_status() return response.json() def retrieve_regional_offices(postcode): response = api_client.exporting.lookup_regional_offices_by_postcode(postcode) response.raise_for_status() return response.json()
from directory_constants.helpers import get_url # SERVICES HOME = get_url('DIRECTORY_CONSTANTS_URL_GREAT_MAGNA', 'https://www.great.gov.uk') INTERNATIONAL = HOME / 'international' # Header links LEARN = HOME / 'learn' WHERE_TO_EXPORT = HOME / 'where-to-export' LEARN_TO_EXPORT = LEARN / 'categories' EXPORT_PLAN = HOME / 'export-plan' EXPORT_PLAN_DASHBOARD = EXPORT_PLAN / 'dashboard' ADVICE = HOME / 'advice' ACCOUNT = HOME / 'profile' MARKETS = HOME / 'markets' SEARCH = HOME / 'search' MARKETS = HOME / 'markets' GET_FINANCE = HOME / 'get-finance' GREAT_DOMESTIC_NEWS = HOME / 'news' SERVICES = HOME / 'services' ABOUT = HOME / 'about' COOKIE_PREFERENCE_SETTINGS = HOME / 'cookies' # footer links CONTACT_US = HOME / 'contact' CONTACT_US_HELP = CONTACT_US / 'help' PRIVACY_AND_COOKIES = HOME / 'privacy-and-cookies'
from directory_constants.helpers import get_url # SERVICES HOME = get_url('DIRECTORY_CONSTANTS_URL_GREAT_DOMESTIC', 'https://www.great.gov.uk') EVENTS = get_url('DIRECTORY_CONSTANTS_URL_EVENTS', 'https://www.events.great.gov.uk') SELLING_OVERSEAS = get_url( 'DIRECTORY_CONSTANTS_URL_SELLING_ONLINE_OVERSEAS', 'https://selling-online-overseas.export.great.gov.uk') # noqa SINGLE_SIGN_ON = get_url('DIRECTORY_CONSTANTS_URL_SINGLE_SIGN_ON', HOME / 'sso') EXPORT_OPPORTUNITIES = get_url('DIRECTORY_CONSTANTS_URL_EXPORT_OPPORTUNITIES', HOME / 'export-opportunities') FIND_A_BUYER = get_url('DIRECTORY_CONSTANTS_URL_FIND_A_BUYER', HOME / 'find-a-buyer') SINGLE_SIGN_ON_PROFILE = get_url('DIRECTORY_CONSTANTS_URL_SSO_PROFILE', HOME / 'profile') # Export readiness/great domestic article sections ADVICE = HOME / 'advice' ADVICE_CREATE_AN_EXPORT_PLAN = ADVICE / 'create-an-export-plan' ADVICE_FIND_AN_EXPORT_MARKET = ADVICE / 'find-an-export-market' ADVICE_DEFINE_ROUTE_TO_MARKET = ADVICE / 'define-route-to-market' ADVICE_GET_EXPORT_FINANCE_AND_FUNDING = ADVICE / 'get-export-finance-and-funding' ADVICE_MANAGE_PAYMENT_FOR_EXPORT_ORDERS = ADVICE / 'manage-payment-for-export-orders' ADVICE_PREPARE_TO_DO_BUSINESS_IN_A_FOREIGN_COUNTRY = ADVICE / 'prepare-to-do-business-in-a-foreign-country' ADVICE_MANAGE_LEGAL_AND_ETHICAL_COMPLIANCE = ADVICE / 'manage-legal-and-ethical-compliance' ADVICE_PREPARE_FOR_EXPORT_PROCEDURES_AND_LOGISTICS = ADVICE / 'prepare-for-export-procedures-and-logistics' SEARCH = HOME / 'search'
def test_get_url_value_present(settings): settings.TEST_VALUE = 'https://example.com' actual = get_url('TEST_VALUE', 'https://other-site.com') assert actual == 'https://example.com'