Skip to content

Commit c36c411

Browse files
author
Kevin Hannegan
committed
update tests
1 parent 2e3853b commit c36c411

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

test/star.pptx

-35.1 KB
Binary file not shown.

test/test_client.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,30 @@ def setUp(self):
1717

1818
def test_client(self):
1919
"""
20-
Tests for client configuration into presalytics api
20+
Tests for client configuration into presalytics api via device grant
2121
"""
22-
client = presalytics.client.api.Client(config_file=self.config_file)
23-
username = os.environ["PRESALYTICS_USERNAME"]
24-
self.assertEqual(client.username, username)
25-
self.assertEqual(client.ooxml_automation.api_client.configuration.host, os.environ["OOXML_AUTOMATION_HOST"])
26-
self.assertNotEqual(client.token_util.token.get("access_token", None), None)
22+
if not presalytics.CONFIG.get("PASSWORD", None):
23+
client = presalytics.client.api.Client(config_file=self.config_file)
24+
username = os.environ["PRESALYTICS_USERNAME"]
25+
self.assertEqual(client.username, username)
26+
self.assertEqual(client.ooxml_automation.api_client.configuration.host, os.environ["OOXML_AUTOMATION_HOST"])
27+
self.assertNotEqual(client.token_util.token.get("access_token", None), None)
2728

2829
def test_password_grant(self):
29-
username = presalytics.CONFIG.get("USERNAME")
30-
password = presalytics.CONFIG.get("PASSWORD")
31-
client_id = os.environ.get("CLIENT_ID")
32-
client_secret = os.environ.get("CLIENT_SECRET")
33-
client = presalytics.client.api.Client(
34-
username=username,
35-
password=password,
36-
client_id=client_id,
37-
client_secret=client_secret
38-
)
30+
"""
31+
tests if password grant works
32+
"""
33+
if presalytics.CONFIG.get("PASSWORD", None):
34+
username = presalytics.CONFIG.get("USERNAME")
35+
password = presalytics.CONFIG.get("PASSWORD")
36+
client_id = os.environ.get("CLIENT_ID")
37+
client_secret = os.environ.get("CLIENT_SECRET")
38+
client = presalytics.client.api.Client(
39+
username=username,
40+
password=password,
41+
client_id=client_id,
42+
client_secret=client_secret
43+
)
3944

4045
def test_module_config(self):
4146
from test.files.config import PRESALYTICS
@@ -54,9 +59,8 @@ def test_api_exception(self):
5459
self.assertEqual(status, 404)
5560

5661
def test_file_download(self):
57-
from test.files.config import PRESALYTICS
5862
test_upload_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'files', 'star.pptx')
59-
client = presalytics.client.api.Client(config=PRESALYTICS)
63+
client = presalytics.client.api.get_client()
6064
try:
6165
test_story = client.story.story_post_file(file=test_upload_file)
6266
download_folder = os.path.dirname(os.path.abspath(__file__))

test/test_story.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_create_outline_from_widget(self):
6565

6666
revealer = presalytics.story.revealer.Revealer(outline)
6767

68-
self.assertEqual(len(revealer.plugin_mgr.dependency_map), 8)
68+
self.assertGreaterEqual(len(revealer.plugin_mgr.dependency_map), 8)
6969

7070
html_str = revealer.package_as_standalone().decode('utf-8')
7171

0 commit comments

Comments
 (0)