def test_error_response_for_get_request_of_type_json_has_json_format(self): fake_urls = [] fake_urls.append(main.get_redirect_route(r'/fake', self.FakeHandler)) fake_urls.append(main.URLS[-1]) with self.swap(main, 'URLS', fake_urls): transaction_services = models.Registry.import_transaction_services() app = transaction_services.toplevel_wrapper( # pylint: disable=invalid-name webapp2.WSGIApplication(main.URLS, debug=feconf.DEBUG)) self.testapp = webtest.TestApp(app) response = self.get_json('/fake', expect_errors=True) self.assertTrue(isinstance(response, dict)) self.assertEqual(500, response['code'])
def test_error_response_for_get_request_of_type_json_has_json_format(self): fake_urls = [] fake_urls.append(main.get_redirect_route(r'/fake', self.FakeHandler)) fake_urls.append(main.URLS[-1]) with self.swap(main, 'URLS', fake_urls): transaction_services = models.Registry.import_transaction_services( ) app = transaction_services.toplevel_wrapper( # pylint: disable=invalid-name webapp2.WSGIApplication(main.URLS, debug=feconf.DEBUG)) self.testapp = webtest.TestApp(app) response = self.get_json('/fake', expect_errors=True, expected_status_int=500) self.assertTrue(isinstance(response, dict))
def test_maintenance_page(self): fake_urls = [] fake_urls.append( main.get_redirect_route(r'/maintenance', pages.MaintenancePage)) with self.swap(main, 'URLS', fake_urls): transaction_services = models.Registry.import_transaction_services( ) app = transaction_services.toplevel_wrapper( webapp2.WSGIApplication(main.URLS, debug=feconf.DEBUG)) self.testapp = webtest.TestApp(app) response = self.get_html_response('/maintenance') self.assertIn( 'Oppia is currently being upgraded, and the site should be up', response.body)
# distributed under the License is distributed on an "AS-IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Main package for URL routing for requests originating from the task queue.""" # pylint: disable=relative-import from core.controllers import feedback from core.platform import models import feconf import main # pylint: enable=relative-import import webapp2 transaction_services = models.Registry.import_transaction_services() # Register the URLs with the classes responsible for handling them. URLS = [ main.get_redirect_route( r'%s' % feconf.FEEDBACK_MESSAGE_EMAIL_HANDLER_URL, feedback.UnsentFeedbackEmailHandler, 'feedback_message_email_handler'), main.get_redirect_route( r'%s' % feconf.SUGGESTION_EMAIL_HANDLER_URL, feedback.SuggestionEmailHandler, 'suggestion_email_handler'), ] app = transaction_services.toplevel_wrapper( # pylint: disable=invalid-name webapp2.WSGIApplication(URLS, debug=feconf.DEBUG))
# distributed under the License is distributed on an "AS-IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Main package for URL routing for incoming emails.""" from __future__ import absolute_import # pylint: disable=import-only-modules from __future__ import unicode_literals # pylint: disable=import-only-modules from core.controllers import incoming_emails from core.platform import models import feconf import main # pylint: disable=wrong-import-order import webapp2 # pylint: enable=wrong-import-order transaction_services = models.Registry.import_transaction_services() # Register the URLs with the classes responsible for handling them. URLS = [ main.get_redirect_route( '/_ah/mail/reply+<reply_to_id>@%s' % feconf.INCOMING_EMAILS_DOMAIN_NAME, incoming_emails.IncomingReplyEmailHandler), ] app = transaction_services.toplevel_wrapper( # pylint: disable=invalid-name webapp2.WSGIApplication(URLS, debug=feconf.DEBUG))
from __future__ import absolute_import # pylint: disable=import-only-modules from __future__ import unicode_literals # pylint: disable=import-only-modules from core.controllers import cron from core.platform import models import feconf import main import webapp2 transaction_services = models.Registry.import_transaction_services() # Register the URLs with the classes responsible for handling them. URLS = [ main.get_redirect_route(r'/cron/mail/admin/job_status', cron.JobStatusMailerHandler), main.get_redirect_route(r'/cron/users/dashboard_stats', cron.CronDashboardStatsHandler), main.get_redirect_route(r'/cron/users/user_deletion', cron.CronUserDeletionHandler), main.get_redirect_route(r'/cron/users/fully_complete_user_deletion', cron.CronFullyCompleteUserDeletionHandler), main.get_redirect_route(r'/cron/explorations/recommendations', cron.CronExplorationRecommendationsHandler), main.get_redirect_route(r'/cron/explorations/search_rank', cron.CronActivitySearchRankHandler), main.get_redirect_route(r'/cron/jobs/cleanup', cron.CronMapreduceCleanupHandler), main.get_redirect_route( r'/cron/mail/admins/contributor_dashboard_bottlenecks', cron.CronMailAdminContributorDashboardBottlenecksHandler),
from __future__ import absolute_import # pylint: disable=import-only-modules from __future__ import unicode_literals # pylint: disable=import-only-modules from core.controllers import cron from core.platform import models import feconf import main import webapp2 transaction_services = models.Registry.import_transaction_services() # Register the URLs with the classes responsible for handling them. URLS = [ main.get_redirect_route( r'/cron/mail/admin/job_status', cron.JobStatusMailerHandler), main.get_redirect_route( r'/cron/users/dashboard_stats', cron.CronDashboardStatsHandler), main.get_redirect_route( r'/cron/users/user_deletion', cron.CronUserDeletionHandler), main.get_redirect_route( r'/cron/users/fully_complete_user_deletion', cron.CronFullyCompleteUserDeletionHandler), main.get_redirect_route( r'/cron/explorations/recommendations', cron.CronExplorationRecommendationsHandler), main.get_redirect_route( r'/cron/explorations/search_rank', cron.CronActivitySearchRankHandler), main.get_redirect_route( r'/cron/jobs/cleanup', cron.CronMapreduceCleanupHandler),
from __future__ import absolute_import # pylint: disable=import-only-modules from __future__ import unicode_literals # pylint: disable=import-only-modules from core.controllers import tasks from core.platform import models import feconf import main import webapp2 transaction_services = models.Registry.import_transaction_services( ) # type: ignore[no-untyped-call] # Register the URLs with the classes responsible for handling them. URLS = [ main.get_redirect_route(r'%s' % feconf.TASK_URL_FEEDBACK_MESSAGE_EMAILS, tasks.UnsentFeedbackEmailHandler), main.get_redirect_route(r'%s' % feconf.TASK_URL_SUGGESTION_EMAILS, tasks.SuggestionEmailHandler), main.get_redirect_route(r'%s' % feconf.TASK_URL_FLAG_EXPLORATION_EMAILS, tasks.FlagExplorationEmailHandler), main.get_redirect_route(r'%s' % feconf.TASK_URL_INSTANT_FEEDBACK_EMAILS, tasks.InstantFeedbackMessageEmailHandler), main.get_redirect_route(r'%s' % feconf.TASK_URL_FEEDBACK_STATUS_EMAILS, tasks.FeedbackThreadStatusChangeEmailHandler), main.get_redirect_route(r'%s' % feconf.TASK_URL_DEFERRED, tasks.DeferredTasksHandler), ] app = transaction_services.toplevel_wrapper( # pylint: disable=invalid-name webapp2.WSGIApplication(URLS, debug=feconf.DEBUG))
# pylint: disable=relative-import from core.controllers import cron from core.platform import models import feconf import main import webapp2 # pylint: enable=relative-import transaction_services = models.Registry.import_transaction_services() # Register the URLs with the classes responsible for handling them. URLS = [ main.get_redirect_route(r'/cron/mail/admin/job_status', cron.JobStatusMailerHandler), main.get_redirect_route(r'/cron/users/dashboard_stats', cron.CronDashboardStatsHandler), main.get_redirect_route(r'/cron/explorations/recommendations', cron.CronExplorationRecommendationsHandler), main.get_redirect_route(r'/cron/explorations/search_rank', cron.CronActivitySearchRankHandler), main.get_redirect_route(r'/cron/jobs/cleanup', cron.CronMapreduceCleanupHandler), main.get_redirect_route(r'/cron/suggestions/accept_stale_suggestions', cron.CronAcceptStaleSuggestionsHandler), ] app = transaction_services.toplevel_wrapper( # pylint: disable=invalid-name webapp2.WSGIApplication(URLS, debug=feconf.DEBUG))
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Main package for URL routing and the index page.""" __author__ = 'Sean Lip' import feconf from core.controllers import cron from core.platform import models transaction_services = models.Registry.import_transaction_services() import main import webapp2 # Register the URLs with the classes responsible for handling them. urls = [ main.get_redirect_route( r'/cron/mail/admin/job_status', cron.JobStatusMailerHandler, 'job_failure_mailer'), main.get_redirect_route( r'/cron/jobs/cleanup', cron.CronMapreduceCleanupHandler, 'job_cleanup_handler'), ] app = transaction_services.toplevel_wrapper( webapp2.WSGIApplication(urls, debug=feconf.DEBUG))
# pylint: disable=relative-import from core.controllers import tasks from core.platform import models import feconf import main # pylint: enable=relative-import import webapp2 transaction_services = models.Registry.import_transaction_services() # Register the URLs with the classes responsible for handling them. URLS = [ main.get_redirect_route( r'%s' % feconf.TASK_URL_FEEDBACK_MESSAGE_EMAILS, tasks.UnsentFeedbackEmailHandler, 'feedback_message_email_task_handler'), main.get_redirect_route( r'%s' % feconf.TASK_URL_SUGGESTION_EMAILS, tasks.SuggestionEmailHandler, 'suggestion_email_task_handler'), main.get_redirect_route( r'%s' % feconf.TASK_URL_INSTANT_FEEDBACK_EMAILS, tasks.InstantFeedbackMessageEmailHandler, 'instant_feedback_message_email_task_handler'), main.get_redirect_route( r'%s' % feconf.TASK_URL_FEEDBACK_STATUS_EMAILS, tasks.FeedbackThreadStatusChangeEmailHandler, 'feedback_thread_status_change_email_task_handler'), ]
# pylint: disable=relative-import from core.controllers import tasks from core.platform import models import feconf import main # pylint: enable=relative-import import webapp2 transaction_services = models.Registry.import_transaction_services() # Register the URLs with the classes responsible for handling them. URLS = [ main.get_redirect_route(r'%s' % feconf.TASK_URL_FEEDBACK_MESSAGE_EMAILS, tasks.UnsentFeedbackEmailHandler, 'feedback_message_email_task_handler'), main.get_redirect_route(r'%s' % feconf.TASK_URL_SUGGESTION_EMAILS, tasks.SuggestionEmailHandler, 'suggestion_email_task_handler'), main.get_redirect_route(r'%s' % feconf.TASK_URL_INSTANT_FEEDBACK_EMAILS, tasks.InstantFeedbackMessageEmailHandler, 'instant_feedback_message_email_task_handler'), main.get_redirect_route( r'%s' % feconf.TASK_URL_FEEDBACK_STATUS_EMAILS, tasks.FeedbackThreadStatusChangeEmailHandler, 'feedback_thread_status_change_email_task_handler'), ] app = transaction_services.toplevel_wrapper( # pylint: disable=invalid-name webapp2.WSGIApplication(URLS, debug=feconf.DEBUG))
# pylint: disable=relative-import from core.controllers import cron from core.platform import models import feconf import main # pylint: enable=relative-import import webapp2 transaction_services = models.Registry.import_transaction_services() # Register the URLs with the classes responsible for handling them. URLS = [ main.get_redirect_route( r'/cron/mail/admin/job_status', cron.JobStatusMailerHandler, 'job_failure_mailer'), main.get_redirect_route( r'/cron/users/dashboard_stats', cron.CronDashboardStatsHandler, 'job_creator_dashboard_stats'), main.get_redirect_route( r'/cron/explorations/recommendations', cron.CronExplorationRecommendationsHandler, 'exploration_recommendations_handler'), main.get_redirect_route( r'/cron/explorations/search_rank', cron.CronExplorationSearchRankHandler, 'exploration_search_rank_handler'), main.get_redirect_route( r'/cron/jobs/cleanup', cron.CronMapreduceCleanupHandler, 'job_cleanup_handler'),
# pylint: disable=relative-import from core.controllers import tasks from core.platform import models import feconf import main # pylint: enable=relative-import import webapp2 transaction_services = models.Registry.import_transaction_services() # Register the URLs with the classes responsible for handling them. URLS = [ main.get_redirect_route( r'%s' % feconf.TASK_URL_FEEDBACK_MESSAGE_EMAILS, tasks.UnsentFeedbackEmailHandler), main.get_redirect_route( r'%s' % feconf.TASK_URL_SUGGESTION_EMAILS, tasks.SuggestionEmailHandler), main.get_redirect_route( r'%s' % feconf.TASK_URL_FLAG_EXPLORATION_EMAILS, tasks.FlagExplorationEmailHandler), main.get_redirect_route( r'%s' % feconf.TASK_URL_INSTANT_FEEDBACK_EMAILS, tasks.InstantFeedbackMessageEmailHandler), main.get_redirect_route( r'%s' % feconf.TASK_URL_FEEDBACK_STATUS_EMAILS, tasks.FeedbackThreadStatusChangeEmailHandler), ]
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS-IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Main package for URL routing for requests originating from the task queue.""" # pylint: disable=relative-import from core.controllers import feedback from core.platform import models import feconf import main # pylint: enable=relative-import import webapp2 transaction_services = models.Registry.import_transaction_services() # Register the URLs with the classes responsible for handling them. URLS = [ main.get_redirect_route(r'%s' % feconf.FEEDBACK_MESSAGE_EMAIL_HANDLER_URL, feedback.UnsentFeedbackEmailHandler, 'feedback_message_email_handler'), main.get_redirect_route(r'%s' % feconf.SUGGESTION_EMAIL_HANDLER_URL, feedback.SuggestionEmailHandler, 'suggestion_email_handler'), ] app = transaction_services.toplevel_wrapper( # pylint: disable=invalid-name webapp2.WSGIApplication(URLS, debug=feconf.DEBUG))
# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS-IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Main package for URL routing and the index page.""" __author__ = 'Sean Lip' import feconf from core.controllers import cron from core.platform import models transaction_services = models.Registry.import_transaction_services() import main import webapp2 # Register the URLs with the classes responsible for handling them. urls = [ main.get_redirect_route(r'/cron/mail/admin/job_status', cron.JobStatusMailerHandler, 'job_failure_mailer'), main.get_redirect_route(r'/cron/jobs/cleanup', cron.CronMapreduceCleanupHandler, 'job_cleanup_handler'), ] app = transaction_services.toplevel_wrapper( webapp2.WSGIApplication(urls, debug=feconf.DEBUG))