Пример #1
0
 def test_service_principal_auth_client_secret(self):
     sp_auth = ServicePrincipalAuth('verySecret!')
     result = sp_auth.get_entry_to_persist('sp_id1', 'tenant1')
     self.assertEqual(result, {
         'servicePrincipalId': 'sp_id1',
         'servicePrincipalTenant': 'tenant1',
         'accessToken': 'verySecret!'
     })
 def test_service_principal_auth_client_secret(self):
     sp_auth = ServicePrincipalAuth('verySecret!')
     result = sp_auth.get_entry_to_persist('sp_id1', 'tenant1')
     self.assertEqual(result, {
         'servicePrincipalId': 'sp_id1',
         'servicePrincipalTenant': 'tenant1',
         'accessToken': 'verySecret!'
     })
Пример #3
0
    def test_service_principal_auth_client_cert(self):
        curr_dir = os.path.dirname(os.path.realpath(__file__))
        test_cert_file = os.path.join(curr_dir, 'sp_cert.pem')
        sp_auth = ServicePrincipalAuth(test_cert_file)

        result = sp_auth.get_entry_to_persist('sp_id1', 'tenant1')
        self.assertEqual(result, {
            'servicePrincipalId': 'sp_id1',
            'servicePrincipalTenant': 'tenant1',
            'certificateFile': test_cert_file,
            'thumbprint': 'F0:6A:53:84:8B:BE:71:4A:42:90:D6:9D:33:52:79:C1:D0:10:73:FD'
        })
    def test_service_principal_auth_client_cert(self):
        curr_dir = os.path.dirname(os.path.realpath(__file__))
        test_cert_file = os.path.join(curr_dir, 'sp_cert.pem')
        sp_auth = ServicePrincipalAuth(test_cert_file)

        result = sp_auth.get_entry_to_persist('sp_id1', 'tenant1')
        self.assertEqual(result, {
            'servicePrincipalId': 'sp_id1',
            'servicePrincipalTenant': 'tenant1',
            'certificateFile': test_cert_file,
            'thumbprint': 'F0:6A:53:84:8B:BE:71:4A:42:90:D6:9D:33:52:79:C1:D0:10:73:FD'
        })