Beispiel #1
0
    def setUp(self):
        super(TestCallbackView, self).setUp()
        self.user = AuthUserFactory()
        self.external_account = ExternalAccountFactory()
        self.institution = InstitutionFactory()

        self.provider = MockOAuth2Provider(self.external_account)

        self.user.affiliated_institutions.add(self.institution)

        app = flask.Flask(__name__)
        make_url_map(app)
        app.config['SECRET_KEY'] = 'aaaaa'
        self.ctx = app.test_request_context()
        self.ctx.push()

        self.request = RequestFactory().get('/fake_path')
        add_session_to_request(self.request)
        self.view0 = views.ConnectView()
        self.view0 = setup_user_view(self.view0, self.request, user=self.user)
        self.view0.kwargs = {
            'addon_name': self.external_account.provider,
            'institution_id': self.institution.id,
        }

        self.view = views.CallbackView()
        self.view = setup_user_view(self.view, self.request, user=self.user)
        self.view.kwargs = {
            'addon_name': self.external_account.provider,
            'institution_id': self.institution.id,
        }
Beispiel #2
0
    def setUp(self):
        super(TestConnectView, self).setUp()
        self.user = AuthUserFactory()
        self.external_account = ExternalAccountFactory()
        self.institution = InstitutionFactory()

        self.user.affiliated_institutions.add(self.institution)

        self.provider = MockOAuth2Provider(self.external_account)

        self.request = RequestFactory().get('/fake_path')
        add_session_to_request(self.request)
        self.view = views.ConnectView()
        self.view = setup_user_view(self.view, self.request, user=self.user)
        self.view.kwargs = {
            'addon_name': self.external_account.provider,
            'institution_id': self.institution.id,
        }
Beispiel #3
0
 def setUp(self):
     super(TestExternalAccount, self).setUp()
     self.user = AuthUserFactory()
     self.provider = MockOAuth2Provider()
Beispiel #4
0
 def setUp(self):
     super(TestExternalProviderOAuth2, self).setUp()
     self.user = UserFactory()
     self.provider = MockOAuth2Provider()