Skip to content

Commit d49d21c

Browse files
authored
Merge pull request #17 from mire3212/update-tests
Refreshing Tests and Minor Tweaks
2 parents 8f0c27a + d06b656 commit d49d21c

File tree

9 files changed

+62
-75
lines changed

9 files changed

+62
-75
lines changed

jupiterone/client.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# see https://github.com/PyCQA/pylint/issues/409
44

55
import json
6+
from warnings import warn
67
from typing import Dict, List
78

89
import requests
@@ -50,11 +51,11 @@ def __init__(self, account: str = None, token: str = None, url: str = DEFAULT_UR
5051
self.account = account
5152
self.token = token
5253
self.url = url
53-
self.query_endpoint = self.url + "/graphql"
54+
self.query_endpoint = self.url
5455
self.rules_endpoint = self.url + "/rules/graphql"
5556
self.headers = {
5657
"Authorization": "Bearer {}".format(self.token),
57-
"Jupiterone-Account": self.account,
58+
"JupiterOne-Account": self.account,
5859
}
5960

6061
@property
@@ -90,7 +91,7 @@ def _execute_query(self, query: str, variables: Dict = None) -> Dict:
9091
if variables:
9192
data.update(variables=variables)
9293

93-
# Always ask for variableresultsize
94+
# Always ask for variableResultSize
9495
data.update(flags={"variableResultSize": True})
9596

9697
response = requests.post(
@@ -124,7 +125,7 @@ def _execute_query(self, query: str, variables: Dict = None) -> Dict:
124125
raise JupiterOneApiRetryError("JupiterOne API rate limit exceeded.")
125126

126127
elif response.status_code in [504]:
127-
raise JupiterOneApiRetryError("Bad Gateway error. Check network route and try again.")
128+
raise JupiterOneApiRetryError("Gateway Timeout.")
128129

129130
elif response.status_code in [500]:
130131
raise JupiterOneApiError("JupiterOne API internal server error.")

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
install_reqs = [
55
'requests',
6-
'retrying',
7-
'warnings'
6+
'retrying'
87
]
98

109
setup(name='jupiterone',

tests/pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
pythonpath = ..

tests/test_create_entity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def request_callback(request):
3232
return (200, headers, json.dumps(response))
3333

3434
responses.add_callback(
35-
responses.POST, 'https://api.us.jupiterone.io/graphql',
35+
responses.POST, 'https://graphql.us.jupiterone.io',
3636
callback=request_callback,
3737
content_type='application/json',
3838
)

tests/test_create_relationship.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def request_callback(request):
3636
return (200, headers, json.dumps(response))
3737

3838
responses.add_callback(
39-
responses.POST, 'https://api.us.jupiterone.io/graphql',
39+
responses.POST, 'https://graphql.us.jupiterone.io',
4040
callback=request_callback,
4141
content_type='application/json',
4242
)

tests/test_delete_entity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def request_callback(request):
3333
return (200, headers, json.dumps(response))
3434

3535
responses.add_callback(
36-
responses.POST, 'https://api.us.jupiterone.io/graphql',
36+
responses.POST, 'https://graphql.us.jupiterone.io',
3737
callback=request_callback,
3838
content_type='application/json',
3939
)

tests/test_delete_relationship.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def request_callback(request):
3636
return (200, headers, json.dumps(response))
3737

3838
responses.add_callback(
39-
responses.POST, 'https://api.us.jupiterone.io/graphql',
39+
responses.POST, 'https://graphql.us.jupiterone.io',
4040
callback=request_callback,
4141
content_type='application/json',
4242
)

0 commit comments

Comments
 (0)