def test_two_auth_background_step_2fa_multiple(self): # multiple 2fa metods available response_2fa = MockResponse() response_2fa.content_json['user_info']['data']['two_factor_enrolled'] = True response_2fa.content_json['user_info']['data']['two_factor_enrolled_with'] = ['yubikey', 'totp'] oauth_2fa = MockOAuth(response_2fa) background(builder=self.builder, meta=self.meta, oauth=oauth_2fa)
def test_two_auth_background_step_no_2fa(self): oauth_no_2fa = MockOAuth() _background(builder=self.builder, meta=self.meta, oauth=oauth_no_2fa, config_dict=mock_config_dict, lets_connect=False)
def test_background_no_profile(self): response = MockResponse(content_json={"profile_list": {"data": []}}) oauth = MockOAuth(response=response) with self.assertRaises(EduvpnException): _background(meta=self.meta, builder=self.builder, dialog=None, oauth=oauth)
def setUpClass(cls): cls.meta = Metadata() cls.meta.uuid = cls.uuid cls.meta.api_base_uri = "test_url" cls.meta.token = {'token_endpoint': 'https://test'} cls.meta.api_base_uri = 'https://test' cls.builder = MockBuilder() cls.oauth = MockOAuth()
def test_two_auth_background_step_2fa(self): response_2fa = MockResponse() response_2fa.content_json['user_info']['data'][ 'two_factor_enrolled'] = True oauth_2fa = MockOAuth(response_2fa) _background(builder=self.builder, meta=self.meta, oauth=oauth_2fa, config_dict=mock_config_dict, lets_connect=False)
def setUpClass(cls): cls.meta = Metadata() cls.meta.uuid = cls.uuid cls.meta.api_base_uri = "test_url" cls.meta.token = {'token_endpoint': 'https://test'} cls.meta.api_base_uri = 'https://test' cls.meta.instance_base_uri = 'https://test' cls.builder = MockBuilder() cls.verifier = MagicMock() cls.oauth = MockOAuth() cls.dialog = MockDialog()
def test_background_one_profile(self, *_): response = MockResponse( content_json={ "profile_list": { "data": [ { "display_name": "test 1", "profile_id": "internet", "two_factor": False }, ] } }) oauth = MockOAuth(response=response) _background(meta=self.meta, builder=self.builder, dialog=None, oauth=oauth)
def setUp(cls): cls.builder = MockBuilder() cls.meta = Metadata() cls.meta.api_base_uri = "https://bla.bla/bla" cls.oauth = MockOAuth()
def test_two_auth_background_step_no_2fa(self): oauth_no_2fa = MockOAuth() background(builder=self.builder, meta=self.meta, oauth=oauth_no_2fa)
def test_two_auth_step(self, *_): response_2fa = MockResponse() response_2fa.content_json['user_info']['data']['two_factor_enrolled'] = True oauth_2fa = MockOAuth(response_2fa) two_auth_step(builder=self.builder, meta=self.meta, oauth=oauth_2fa)
def setUp(self): self.oauth = MockOAuth() self.verify = VerifyMock()