예제 #1
0
 def test_feconf_verification_with_key_absent_and_verification_disabled(
         self):
     temp_feconf_path = tempfile.NamedTemporaryFile().name
     feconf_text = (
         'REDISHOST = \'192.13.2.1\'\n'
         '# When the site terms were last updated, in UTC.\n'
         'REGISTRATION_PAGE_LAST_UPDATED_UTC = '
         'datetime.datetime(2015, 10, 14, 2, 40, 0)\n'
         '# Format of string for dashboard statistics logs.\n'
         '# NOTE TO DEVELOPERS: This format should not be changed, '
         'since it is used in\n'
         '# the existing storage models for UserStatsModel.\n'
         'DASHBOARD_STATS_DATETIME_STRING_FORMAT = \'YY-mm-dd\'\n')
     with python_utils.open_file(temp_feconf_path, 'w') as f:
         f.write(feconf_text)
     update_configs.verify_feconf(temp_feconf_path, False)
예제 #2
0
 def test_feconf_verification_with_key_absent(self):
     temp_feconf_path = tempfile.NamedTemporaryFile().name
     feconf_text = (
         '# When the site terms were last updated, in UTC.\n'
         'REGISTRATION_PAGE_LAST_UPDATED_UTC = '
         'datetime.datetime(2015, 10, 14, 2, 40, 0)\n'
         '# Format of string for dashboard statistics logs.\n'
         '# NOTE TO DEVELOPERS: This format should not be changed, '
         'since it is used in\n'
         '# the existing storage models for UserStatsModel.\n'
         'DASHBOARD_STATS_DATETIME_STRING_FORMAT = \'YY-mm-dd\'\n')
     with python_utils.open_file(temp_feconf_path, 'w') as f:
         f.write(feconf_text)
     with self.assertRaisesRegexp(
             Exception,
             'The mailgun API key must be added before deployment.'):
         update_configs.verify_feconf(temp_feconf_path)
예제 #3
0
 def test_feconf_verification_with_key_present(self):
     mailgun_api_key = ('key-%s' % ('').join(['1'] * 32))
     temp_feconf_path = tempfile.NamedTemporaryFile().name
     feconf_text = (
         'MAILGUN_API_KEY = \'%s\'\n'
         '# When the site terms were last updated, in UTC.\n'
         'REGISTRATION_PAGE_LAST_UPDATED_UTC = '
         'datetime.datetime(2015, 10, 14, 2, 40, 0)\n'
         '# Format of string for dashboard statistics logs.\n'
         '# NOTE TO DEVELOPERS: This format should not be changed, '
         'since it is used in\n'
         '# the existing storage models for UserStatsModel.\n'
         'DASHBOARD_STATS_DATETIME_STRING_FORMAT = \'YY-mm-dd\'\n' %
         (mailgun_api_key))
     with python_utils.open_file(temp_feconf_path, 'w') as f:
         f.write(feconf_text)
     update_configs.verify_feconf(temp_feconf_path)
예제 #4
0
 def test_feconf_verification_with_redishost_absent(self):
     mailgun_api_key = ('key-%s' % ('').join(['1'] * 32))
     mailchimp_api_key = ('%s-us18' % ('').join(['1'] * 32))
     temp_feconf_path = tempfile.NamedTemporaryFile().name
     feconf_text = (
         'MAILGUN_API_KEY = \'%s\'\n'
         'MAILCHIMP_API_KEY = \'%s\'\n'
         '# When the site terms were last updated, in UTC.\n'
         'REGISTRATION_PAGE_LAST_UPDATED_UTC = '
         'datetime.datetime(2015, 10, 14, 2, 40, 0)\n'
         '# Format of string for dashboard statistics logs.\n'
         '# NOTE TO DEVELOPERS: This format should not be changed, '
         'since it is used in\n'
         '# the existing storage models for UserStatsModel.\n'
         'DASHBOARD_STATS_DATETIME_STRING_FORMAT = \'YY-mm-dd\'\n' %
         (mailgun_api_key, mailchimp_api_key))
     with utils.open_file(temp_feconf_path, 'w') as f:
         f.write(feconf_text)
     with self.assertRaisesRegex(
             Exception, 'REDISHOST must be updated before deployment.'):
         update_configs.verify_feconf(temp_feconf_path, True)