def utcnow(): now = datetime.datetime.utcnow().replace(tzinfo=pytz.utc) if settings.TEST: from htk.test_scaffold.models import TestScaffold scaffold = TestScaffold() fake_time = scaffold.get_fake_timestamp() if fake_time: now = fake_time return now
def is_prelaunch_mode(): is_prelaunch = htk_setting('HTK_PRELAUNCH_MODE', HTK_PRELAUNCH_MODE) if settings.TEST: from htk.test_scaffold.models import TestScaffold scaffold = TestScaffold() fake_prelaunch_mode = scaffold.get_fake_prelaunch_mode() if fake_prelaunch_mode is not None: is_prelaunch = fake_prelaunch_mode return is_prelaunch
def utcnow(): now = datetime.datetime.utcnow().replace(tzinfo=utc) if settings.TEST: from htk.test_scaffold.models import TestScaffold scaffold = TestScaffold() fake_time = scaffold.get_fake_timestamp() if fake_time: now = fake_time return now
def is_prelaunch_mode(): is_prelaunch = htk_setting('HTK_PRELAUNCH_MODE', HTK_PRELAUNCH_MODE) if settings.TEST: from htk.test_scaffold.models import TestScaffold scaffold = TestScaffold() fake_prelaunch_mode = scaffold.get_fake_prelaunch_mode() if fake_prelaunch_mode is not None: is_prelaunch = fake_prelaunch_mode return is_prelaunch
def test_view_index(self): view_name = 'index' scaffold = TestScaffold() # prelaunch scaffold.set_fake_prelaunch(prelaunch_mode=True, prelaunch_host=False) self._check_prelaunch_mode(view_name) # post-launch scaffold.set_fake_prelaunch(prelaunch_mode=False, prelaunch_host=False) self._check_view_redirects_to_another(view_name, 'home')
def is_prelaunch_host(host): is_prelaunch = False prelaunch_host_regexps = htk_setting('HTK_PRELAUNCH_HOST_REGEXPS', HTK_PRELAUNCH_HOST_REGEXPS) for prelaunch_host_regexp in prelaunch_host_regexps: match = re.match(prelaunch_host_regexp, host) is_prelaunch = match is not None if is_prelaunch: break if settings.TEST: from htk.test_scaffold.models import TestScaffold scaffold = TestScaffold() fake_prelaunch_host = scaffold.get_fake_prelaunch_host() if fake_prelaunch_host is not None: is_prelaunch = fake_prelaunch_host return is_prelaunch
def is_prelaunch_host(host): is_prelaunch = False prelaunch_host_regexps = htk_setting('HTK_PRELAUNCH_HOST_REGEXPS', HTK_PRELAUNCH_HOST_REGEXPS) for prelaunch_host_regexp in prelaunch_host_regexps: match = re.match(prelaunch_host_regexp, host) is_prelaunch = match is not None if is_prelaunch: break if settings.TEST: from htk.test_scaffold.models import TestScaffold scaffold = TestScaffold() fake_prelaunch_host = scaffold.get_fake_prelaunch_host() if fake_prelaunch_host is not None: is_prelaunch = fake_prelaunch_host return is_prelaunch
def test_general_views(self): view_names = ( 'home', 'about', 'help', 'tos', 'privacy', # meta 'bing_site_auth', 'robots', 'sitemap', ) scaffold = TestScaffold() # prelaunch scaffold.set_fake_prelaunch(prelaunch_mode=True, prelaunch_host=False) for view_name in view_names: self._check_prelaunch_mode(view_name) # post-launch scaffold.set_fake_prelaunch(prelaunch_mode=False, prelaunch_host=False) for view_name in view_names: self._check_view_is_okay(view_name)
def setUp(self): super(BaseWebTestCase, self).setUp() # disable prelaunch mode for unit tests scaffold = TestScaffold() scaffold.set_fake_prelaunch(prelaunch_mode=False, prelaunch_host=False)
def setUp(self): super(BaseWebTestCase, self).setUp() # disable prelaunch mode for unit tests TestScaffold.set_fake_prelaunch(prelaunch_mode=False, prelaunch_host=False)