コード例 #1
0
ファイル: base_test.py プロジェクト: DSeanLaw/oppia
    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'])
コード例 #2
0
    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))
コード例 #3
0
    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)
コード例 #4
0
ファイル: main_taskqueue.py プロジェクト: alexgower/oppia
# 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))
コード例 #5
0
# 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))
コード例 #6
0
ファイル: main_cron.py プロジェクト: xarcode/oppia
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),
コード例 #7
0
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),
コード例 #8
0
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))
コード例 #9
0
ファイル: main_cron.py プロジェクト: sachin-chandani/oppia
# 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))
コード例 #10
0
ファイル: main_cron.py プロジェクト: VictoriaRoux/oppia
# 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))
コード例 #11
0
ファイル: main_taskqueue.py プロジェクト: abhijit5893/oppia
# 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'),
]
コード例 #12
0
# 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))
コード例 #13
0
ファイル: main_cron.py プロジェクト: rcorfield/oppia
# 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'),
コード例 #14
0
# 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),
]
コード例 #15
0
ファイル: main_taskqueue.py プロジェクト: kennychong89/oppia
# 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))
コード例 #16
0
ファイル: main_cron.py プロジェクト: yjli216/oppia
#
# 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))