This repository has been archived by the owner on Oct 1, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- prefills the number field on the contact form
- Loading branch information
Showing
8 changed files
with
99 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
site_config/migrations/0008_siteconfiguration_default_number_prefix.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.10.1 on 2016-10-31 19:01 | ||
from __future__ import unicode_literals | ||
|
||
import apostello.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('site_config', '0007_siteconfiguration_auto_add_new_groups'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='siteconfiguration', | ||
name='default_number_prefix', | ||
field=models.CharField(blank=True, default='', help_text="This value will be used to prepopulate the new contact form use this if you don't want to have to type +xx every time.", max_length=5, validators=[apostello.validators.validate_starts_with_plus]), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from time import sleep | ||
|
||
import pytest | ||
|
||
URI = '/recipient/new/' | ||
|
||
|
||
def load_page(b, wt, url): | ||
b.get(url) | ||
assert url in b.current_url | ||
sleep(wt) | ||
return b | ||
|
||
|
||
@pytest.mark.django_db(transaction=True) | ||
@pytest.mark.slow | ||
@pytest.mark.selenium | ||
class TestDefaultPrefix: | ||
def test_default_prefix( | ||
self, live_server, browser_in, users, driver_wait_time | ||
): | ||
"""Test prefix shows on form.""" | ||
from site_config.models import SiteConfiguration | ||
config = SiteConfiguration.get_solo() | ||
config.default_number_prefix = '+45' | ||
config.save() | ||
b = load_page(browser_in, driver_wait_time, live_server + URI) | ||
assert '+45' in b.page_source | ||
config.default_number_prefix = '' | ||
config.save() | ||
b = load_page(browser_in, driver_wait_time, live_server + URI) | ||
assert '+45' not in b.page_source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters