Example #1
0
    def get(self):
        """Handles GET requests."""
        if not Exploration.get('0', strict=False):
            admin.reload_demos()

        self.values.update({
            'gallery_login_url': users.create_login_url('/gallery'),
        })
        self.render_template('index.html')
Example #2
0
    def test_exploration_end_to_end(self):
        """Test a reader's progression through the default exploration."""
        admin.reload_demos()

        response = self.testapp.get('/learn/0/data')
        self.assertEqual(response.status_int, 200)
        self.assertEqual(response.content_type, 'application/json')

        exploration_json = json.loads(response.body)
        self.assertIn('do you know where the name \'Oppia\'',
                      exploration_json['oppia_html'])
        self.assertEqual(exploration_json['title'], 'Welcome to Oppia!')
        state_id = exploration_json['state_id']

        payload = {'answer': '0', 'block_number': 0, 'handler': 'submit'}
        response = self.testapp.post(
            str('/learn/0/%s' % state_id), {'payload': json.dumps(payload)})
        self.assertEqual(response.status_int, 200)

        exploration_json = json.loads(response.body)
        self.assertIn('In fact, the word Oppia means \'learn\'.',
                      exploration_json['oppia_html'])