def test_get_user_roles(self): self._set_frame_response({'user_roles': ['Anonymous', 'Contributor']}) with self.app.test_request_context(): frame.get_frame_before_request() self.assertEqual(flask.g.user_roles, ['Anonymous', 'Contributor'])
def test_frame_not_called_if_url_blank(self): self.app.config['FRAME_URL'] = None with self.app.test_request_context(): frame.get_frame_before_request() self.assertEqual(self.mock_requests.get.call_count, 0)
def test_get_user_id(self): self._set_frame_response({'user_id': 'smith'}) with self.app.test_request_context(): frame.get_frame_before_request() self.assertEqual(flask.g.user_id, 'smith')
def test_frame_html(self): with self.app.test_request_context(): frame.get_frame_before_request() html = flask.render_template('frame.html') self.assertEqual(html, 'hello framed page!')