File: test_mex.py

package info (click to toggle)
microsoft-authentication-library-for-python 1.34.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,320 kB
  • sloc: python: 8,613; xml: 2,783; sh: 27; makefile: 19
file content (28 lines) | stat: -rw-r--r-- 935 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os

from tests import unittest
from msal.mex import *


THIS_FOLDER = os.path.dirname(__file__)

class TestMex(unittest.TestCase):

    def _test_parser(self, sample, expected_endpoint):
        with open(os.path.join(THIS_FOLDER, sample)) as sample_file:
            endpoint = Mex(mex_document=sample_file.read()
                ).get_wstrust_username_password_endpoint()["address"]
            self.assertEqual(expected_endpoint, endpoint)

    def test_happy_path_1(self):
        self._test_parser("microsoft.mex.xml",
            'https://corp.sts.microsoft.com/adfs/services/trust/13/usernamemixed')

    def test_happy_path_2(self):
        self._test_parser('arupela.mex.xml',
            'https://fs.arupela.com/adfs/services/trust/13/usernamemixed')

    def test_happy_path_3(self):
        self._test_parser('archan.us.mex.xml',
            'https://arvmserver2012.archan.us/adfs/services/trust/13/usernamemixed')