Unverified Commit 811f313c by Jeremy Bowman Committed by GitHub

Merge pull request #16791 from edx/jmbowman/PLAT-1382

PLAT-1382 Populate ALLOWED_HOSTS for tests
parents a9be2b1d da8cf6b5
...@@ -40,6 +40,15 @@ from lms.envs.test import ( ...@@ -40,6 +40,15 @@ from lms.envs.test import (
REGISTRATION_EXTRA_FIELDS, REGISTRATION_EXTRA_FIELDS,
) )
# Add some host names used in assorted tests
ALLOWED_HOSTS = [
'localhost',
'logistration.testserver',
'.testserver.fake',
'test-site.testserver',
'testserver.fakeother',
]
# mongo connection settings # mongo connection settings
MONGO_PORT_NUM = int(os.environ.get('EDXAPP_TEST_MONGO_PORT', '27017')) MONGO_PORT_NUM = int(os.environ.get('EDXAPP_TEST_MONGO_PORT', '27017'))
MONGO_HOST = os.environ.get('EDXAPP_TEST_MONGO_HOST', 'localhost') MONGO_HOST = os.environ.get('EDXAPP_TEST_MONGO_HOST', 'localhost')
......
...@@ -3,7 +3,6 @@ Tests for branding page ...@@ -3,7 +3,6 @@ Tests for branding page
""" """
import datetime import datetime
import pytest
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import AnonymousUser from django.contrib.auth.models import AnonymousUser
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -292,7 +291,6 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase): ...@@ -292,7 +291,6 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase):
@attr(shard=1) @attr(shard=1)
@pytest.mark.django111_expected_failure
class IndexPageProgramsTests(SiteMixin, ModuleStoreTestCase): class IndexPageProgramsTests(SiteMixin, ModuleStoreTestCase):
""" """
Tests for Programs List in Marketing Pages. Tests for Programs List in Marketing Pages.
......
...@@ -5,7 +5,6 @@ from uuid import uuid4 ...@@ -5,7 +5,6 @@ from uuid import uuid4
import ddt import ddt
import datetime import datetime
import pytest
from django.conf import settings from django.conf import settings
from django.core.cache import cache from django.core.cache import cache
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -261,7 +260,6 @@ class MicrositeCertificatesViewsTests(ModuleStoreTestCase): ...@@ -261,7 +260,6 @@ class MicrositeCertificatesViewsTests(ModuleStoreTestCase):
self.store.update_item(self.course, self.user.id) self.store.update_item(self.course, self.user.id)
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED) @override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
@pytest.mark.django111_expected_failure
def test_html_view_for_microsite(self): def test_html_view_for_microsite(self):
test_configuration_string = """{ test_configuration_string = """{
"default": { "default": {
...@@ -311,7 +309,6 @@ class MicrositeCertificatesViewsTests(ModuleStoreTestCase): ...@@ -311,7 +309,6 @@ class MicrositeCertificatesViewsTests(ModuleStoreTestCase):
self.assertIn('Microsite title', response.content) self.assertIn('Microsite title', response.content)
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED) @override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
@pytest.mark.django111_expected_failure
def test_html_view_microsite_configuration_missing(self): def test_html_view_microsite_configuration_missing(self):
test_configuration_string = """{ test_configuration_string = """{
"default": { "default": {
......
...@@ -7,7 +7,6 @@ from collections import OrderedDict ...@@ -7,7 +7,6 @@ from collections import OrderedDict
from urllib import urlencode from urllib import urlencode
from uuid import uuid4 from uuid import uuid4
import pytest
from django.conf import settings from django.conf import settings
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.test.client import Client, RequestFactory from django.test.client import Client, RequestFactory
...@@ -243,7 +242,6 @@ class CommonCertificatesTestCase(ModuleStoreTestCase): ...@@ -243,7 +242,6 @@ class CommonCertificatesTestCase(ModuleStoreTestCase):
@attr(shard=1) @attr(shard=1)
@ddt.ddt @ddt.ddt
@pytest.mark.django111_expected_failure
class CertificatesViewsTests(CommonCertificatesTestCase): class CertificatesViewsTests(CommonCertificatesTestCase):
""" """
Tests for the certificates web/html views Tests for the certificates web/html views
......
...@@ -19,7 +19,6 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory ...@@ -19,7 +19,6 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
@attr(shard=1) @attr(shard=1)
@pytest.mark.django111_expected_failure
class TestSites(SharedModuleStoreTestCase, LoginEnrollmentTestCase): class TestSites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
""" """
This is testing of the Site Configuration feature This is testing of the Site Configuration feature
...@@ -136,6 +135,7 @@ class TestSites(SharedModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -136,6 +135,7 @@ class TestSites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertNotContains(resp, 'This is a Test Site footer') self.assertNotContains(resp, 'This is a Test Site footer')
@override_settings(SITE_NAME=settings.MICROSITE_TEST_HOSTNAME) @override_settings(SITE_NAME=settings.MICROSITE_TEST_HOSTNAME)
@pytest.mark.django111_expected_failure
def test_site_homepage_course_max(self): def test_site_homepage_course_max(self):
""" """
Verify that the number of courses displayed on the homepage honors Verify that the number of courses displayed on the homepage honors
......
...@@ -11,7 +11,6 @@ import shutil ...@@ -11,7 +11,6 @@ import shutil
import tempfile import tempfile
import ddt import ddt
import pytest
from boto.exception import BotoServerError from boto.exception import BotoServerError
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
...@@ -3641,7 +3640,6 @@ class TestEntranceExamInstructorAPIRegradeTask(SharedModuleStoreTestCase, LoginE ...@@ -3641,7 +3640,6 @@ class TestEntranceExamInstructorAPIRegradeTask(SharedModuleStoreTestCase, LoginE
@attr(shard=1) @attr(shard=1)
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message', autospec=True)) @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message', autospec=True))
@pytest.mark.django111_expected_failure
class TestInstructorSendEmail(SiteMixin, SharedModuleStoreTestCase, LoginEnrollmentTestCase): class TestInstructorSendEmail(SiteMixin, SharedModuleStoreTestCase, LoginEnrollmentTestCase):
""" """
Checks that only instructors have access to email endpoints, and that Checks that only instructors have access to email endpoints, and that
...@@ -4527,7 +4525,6 @@ class TestCourseIssuedCertificatesData(SharedModuleStoreTestCase): ...@@ -4527,7 +4525,6 @@ class TestCourseIssuedCertificatesData(SharedModuleStoreTestCase):
@attr(shard=1) @attr(shard=1)
@override_settings(REGISTRATION_CODE_LENGTH=8) @override_settings(REGISTRATION_CODE_LENGTH=8)
@pytest.mark.django111_expected_failure
class TestCourseRegistrationCodes(SharedModuleStoreTestCase): class TestCourseRegistrationCodes(SharedModuleStoreTestCase):
""" """
Test data dumps for E-commerce Course Registration Codes. Test data dumps for E-commerce Course Registration Codes.
......
...@@ -4,7 +4,6 @@ Unit tests for Ecommerce feature flag in new instructor dashboard. ...@@ -4,7 +4,6 @@ Unit tests for Ecommerce feature flag in new instructor dashboard.
import datetime import datetime
import pytest
import pytz import pytz
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
...@@ -19,7 +18,6 @@ from xmodule.modulestore.tests.factories import CourseFactory ...@@ -19,7 +18,6 @@ from xmodule.modulestore.tests.factories import CourseFactory
@attr(shard=1) @attr(shard=1)
@pytest.mark.django111_expected_failure
class TestECommerceDashboardViews(SiteMixin, SharedModuleStoreTestCase): class TestECommerceDashboardViews(SiteMixin, SharedModuleStoreTestCase):
""" """
Check for E-commerce view on the new instructor dashboard Check for E-commerce view on the new instructor dashboard
......
...@@ -8,7 +8,6 @@ from decimal import Decimal ...@@ -8,7 +8,6 @@ from decimal import Decimal
from urlparse import urlparse from urlparse import urlparse
import ddt import ddt
import pytest
import pytz import pytz
from django.conf import settings from django.conf import settings
from django.contrib.admin.sites import AdminSite from django.contrib.admin.sites import AdminSite
...@@ -476,7 +475,6 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin): ...@@ -476,7 +475,6 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
self.assertIn("Cart item quantity should not be greater than 1 when applying activation code", resp.content) self.assertIn("Cart item quantity should not be greater than 1 when applying activation code", resp.content)
@ddt.data(True, False) @ddt.data(True, False)
@pytest.mark.django111_expected_failure
def test_reg_code_uses_associated_mode(self, expired_mode): def test_reg_code_uses_associated_mode(self, expired_mode):
"""Tests the use of reg codes on verified courses, expired or active. """ """Tests the use of reg codes on verified courses, expired or active. """
course_key = self.course_key.to_deprecated_string() course_key = self.course_key.to_deprecated_string()
...@@ -489,7 +487,6 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin): ...@@ -489,7 +487,6 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
self.assertIn(self.course.display_name.encode('utf-8'), resp.content) self.assertIn(self.course.display_name.encode('utf-8'), resp.content)
@ddt.data(True, False) @ddt.data(True, False)
@pytest.mark.django111_expected_failure
def test_reg_code_uses_unknown_mode(self, expired_mode): def test_reg_code_uses_unknown_mode(self, expired_mode):
"""Tests the use of reg codes on verified courses, expired or active. """ """Tests the use of reg codes on verified courses, expired or active. """
course_key = self.course_key.to_deprecated_string() course_key = self.course_key.to_deprecated_string()
...@@ -1443,7 +1440,6 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin): ...@@ -1443,7 +1440,6 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
} }
) )
@pytest.mark.django111_expected_failure
def test_shopping_cart_navigation_link_not_in_microsite(self): def test_shopping_cart_navigation_link_not_in_microsite(self):
""" """
Tests shopping cart link is available in navigation header if request is not from a microsite. Tests shopping cart link is available in navigation header if request is not from a microsite.
...@@ -1478,7 +1474,6 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin): ...@@ -1478,7 +1474,6 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
self.assertEqual(resp.status_code, 200) self.assertEqual(resp.status_code, 200)
self.assertIn('<a class="shopping-cart"', resp.content) self.assertIn('<a class="shopping-cart"', resp.content)
@pytest.mark.django111_expected_failure
def test_shopping_cart_navigation_link_in_microsite_courseware_page(self): def test_shopping_cart_navigation_link_in_microsite_courseware_page(self):
""" """
Tests shopping cart link is not available in navigation header if request is from a microsite Tests shopping cart link is not available in navigation header if request is from a microsite
......
...@@ -588,7 +588,6 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi ...@@ -588,7 +588,6 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
self.assertEqual(enterprise_cookie.value, '') self.assertEqual(enterprise_cookie.value, '')
@override_settings(SITE_NAME=settings.MICROSITE_TEST_HOSTNAME) @override_settings(SITE_NAME=settings.MICROSITE_TEST_HOSTNAME)
@pytest.mark.django111_expected_failure
def test_microsite_uses_old_login_page(self): def test_microsite_uses_old_login_page(self):
# Retrieve the login page from a microsite domain # Retrieve the login page from a microsite domain
# and verify that we're served the old page. # and verify that we're served the old page.
...@@ -599,7 +598,6 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi ...@@ -599,7 +598,6 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
self.assertContains(resp, "Log into your Test Site Account") self.assertContains(resp, "Log into your Test Site Account")
self.assertContains(resp, "login-form") self.assertContains(resp, "login-form")
@pytest.mark.django111_expected_failure
def test_microsite_uses_old_register_page(self): def test_microsite_uses_old_register_page(self):
# Retrieve the register page from a microsite domain # Retrieve the register page from a microsite domain
# and verify that we're served the old page. # and verify that we're served the old page.
......
...@@ -34,6 +34,15 @@ from util.testing import patch_testcase, patch_sessions ...@@ -34,6 +34,15 @@ from util.testing import patch_testcase, patch_sessions
patch_testcase() patch_testcase()
patch_sessions() patch_sessions()
# Add some host names used in assorted tests
ALLOWED_HOSTS = [
'localhost',
'logistration.testserver',
'.testserver.fake',
'test-site.testserver',
'testserver.fakeother',
]
# Silence noisy logs to make troubleshooting easier when tests fail. # Silence noisy logs to make troubleshooting easier when tests fail.
import logging import logging
LOG_OVERRIDES = [ LOG_OVERRIDES = [
......
...@@ -16,7 +16,7 @@ class SiteFactory(DjangoModelFactory): ...@@ -16,7 +16,7 @@ class SiteFactory(DjangoModelFactory):
model = Site model = Site
django_get_or_create = ('domain',) django_get_or_create = ('domain',)
domain = Sequence('testserver.fake.{}'.format) domain = Sequence('{}.testserver.fake'.format)
name = SelfAttribute('domain') name = SelfAttribute('domain')
......
...@@ -16,3 +16,5 @@ if is_comprehensive_theming_enabled(): ...@@ -16,3 +16,5 @@ if is_comprehensive_theming_enabled():
name='openedx.theming.update_theme_fragment_view', name='openedx.theming.update_theme_fragment_view',
), ),
] ]
else:
urlpatterns = []
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment