diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..e1ec1bf1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +sudo: false +language: python +python: + - "2.7" + - "3.5" + - "3.6" +install: + - pip install -r requirements.txt +script: + - python -m unittest discover -s tests diff --git a/tests/test_application.py b/tests/test_application.py index 0a8776f2..65d5d76d 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -5,13 +5,20 @@ from tests import unittest +THIS_FOLDER = os.path.dirname(__file__) +CONFIG_FILE = os.path.join(THIS_FOLDER, 'config.json') + + +@unittest.skipUnless(os.path.exists(CONFIG_FILE), "%s missing" % CONFIG_FILE) class TestConfidentialClientApplication(unittest.TestCase): - same_folder = os.path.dirname(__file__) - config = json.load(open(os.path.join(same_folder, 'config.json'))) scope = ["https://graph.microsoft.com/.default"] scope2 = ["User.Read"] scope_rt = ["offline_access"] + @classmethod + def setUpClass(cls): + cls.config = json.load(open(CONFIG_FILE)) + def test_confidential_client_using_secret(self): app = ConfidentialClientApplication( self.config['CLIENT_ID'], self.config['CLIENT_SECRET']) @@ -19,7 +26,7 @@ def test_confidential_client_using_secret(self): self.assertIn('access_token', result) def test_confidential_client_using_certificate(self): - private_key = os.path.join(self.same_folder, self.config['PRIVATE_KEY']) + private_key = os.path.join(THIS_FOLDER, self.config['PRIVATE_KEY']) with open(private_key) as f: pem = f.read() certificate = { 'certificate': pem,