def test_cert_bad_thumbprint(self): thumbprint = "gobbledy" with self.assertRaisesRegexp(Exception, "thumbprint does not match a known format"): adal._acquire_token_with_client_certificate( cp["authorityTenant"], cp["clientId"], cp["cert"], thumbprint, cp["resource"] )
def test_cert_bad_thumbprint(self): thumbprint = 'gobbledy' with self.assertRaisesRegexp( Exception, 'thumbprint does not match a known format'): adal._acquire_token_with_client_certificate( cp['authorityTenant'], cp['clientId'], cp['cert'], thumbprint, cp['resource'])
def test_cert_bad_cert(self): cert = 'gobbledy' with self.assertRaisesRegexp( Exception, "Error:Invalid Certificate: Expected Start of Certificate to be '-----BEGIN RSA PRIVATE KEY-----'" ): adal._acquire_token_with_client_certificate( cp['authorityTenant'], cp['clientId'], cert, cp['certHash'], cp['resource'])
def test_cert_bad_cert(self): cert = "gobbledy" with self.assertRaisesRegexp( Exception, "Error:Invalid Certificate: Expected Start of Certificate to be '-----BEGIN RSA PRIVATE KEY-----'", ): adal._acquire_token_with_client_certificate( cp["authorityTenant"], cp["clientId"], cert, cp["certHash"], cp["resource"] )
def test_cert_happy_path(self): """ TODO: Test Failing as of 2015/06/03 and needs to be completed. """ self.fail("Not Yet Impelemented. Add Helper Functions and setup method") saveProto = updateSelfSignedJwtStubs() responseOptions = {noRefresh: true} response = util.create_response(responseOptions) tokenRequest = util.setupExpectedClientAssertionTokenRequestResponse( 200, response.wireResponse, cp["authorityTenant"] ) adal._acquire_token_with_client_certificate( cp["authorityTenant"], cp["clientId"], cp["cert"], cp["certHash"], response.resource ) resetSelfSignedJwtStubs(saveProto) self.assertTrue( util.is_match_token_response(response.cachedResponse, token_response), "The response did not match what was expected", )
def test_cert_happy_path(self): ''' TODO: Test Failing as of 2015/06/03 and needs to be completed. ''' self.fail( "Not Yet Impelemented. Add Helper Functions and setup method") saveProto = updateSelfSignedJwtStubs() responseOptions = {noRefresh: true} response = util.create_response(responseOptions) tokenRequest = util.setupExpectedClientAssertionTokenRequestResponse( 200, response.wireResponse, cp['authorityTenant']) adal._acquire_token_with_client_certificate(cp['authorityTenant'], cp['clientId'], cp['cert'], cp['certHash'], response.resource) resetSelfSignedJwtStubs(saveProto) self.assertTrue( util.is_match_token_response(response.cachedResponse, token_response), 'The response did not match what was expected')