﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18408	flatpages - tests expect site 1 to be example.com	jens@…	nobody	"There is a test failure in django.contrib.flatpages that occurs when a project has customized the domain for Sites.site 1.  
See pull request 83 (https://github.com/django/django/pull/83) on !GitHub with a proposed fix.  

Steps to reproduce:

1. Create a new project and app
2. Make necessary configuration changes for flatpages, sites, and test app & syncdb
3. Create initial_data fixture for site id 1 and update the domain to something other than example.com (for example: 127.0.0.1:8000)
4. Run tests
{{{
FAIL: test_flatpage_admin_form_url_uniqueness_validation (django.contrib.flatpages.tests.forms.FlatpageAdminFormTests)
The flatpage admin form correctly enforces url uniqueness among flatpages of the same site
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""/Users/jpage/Projects/Django/venv/src/django/django/contrib/flatpages/tests/forms.py"", line 60, in test_flatpage_admin_form_url_uniqueness_validation
    {'__all__': [u'Flatpage with url /myflatpage1/ already exists for site example.com']})
AssertionError: {'__all__': [u'Flatpage with url /myflatpage1/ already exists for site 127.0.0.1:8000']} != {'__all__': [u'Flatpage with url /myflatpage1/ already exists for site example.com']}

----------------------------------------------------------------------
Ran 462 tests in 18.547s

FAILED (failures=1, skipped=1)
Destroying test database for alias 'default'...
}}}

The proposed fix adds an example_site test fixture to address the issue above.  It also overrides the project's SITE_ID to 1 to address issues when running tests with a project's SITE_ID set to something other than 1.  It also normalizes the use of the hard coded site id 1 to settings.SITE_ID for consistency.  

Link to !GitHub pull request:
https://github.com/django/django/pull/83



Let me know if there are any changes, I am just trying to do my part and give a little back.  "	Bug	closed	contrib.flatpages	1.4	Normal	fixed			Unreviewed	1	0	0	0	0	0
