-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop returning only the data, there can also be a meta field
- Loading branch information
David Moreau-Simard
committed
Jul 27, 2016
1 parent
dd469c0
commit f757b61
Showing
2 changed files
with
18 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,28 +33,28 @@ | |
status=1, | ||
description='Test component')) | ||
print(components.get()) | ||
components.put(id=new_component['id'], description='Updated component') | ||
print(components.get(id=new_component['id'])) | ||
components.delete(id=new_component['id']) | ||
components.put(id=new_component['data']['id'], description='Updated component') | ||
print(components.get(id=new_component['data']['id'])) | ||
components.delete(id=new_component['data']['id']) | ||
|
||
# /components/groups | ||
groups = cachet.Groups(endpoint=ENDPOINT, api_token=API_TOKEN) | ||
new_group = json.loads(groups.post(name='Test group')) | ||
print(groups.get()) | ||
groups.put(id=new_group['id'], name='Updated group') | ||
print(groups.get(id=new_group['id'])) | ||
groups.delete(new_group['id']) | ||
groups.put(id=new_group['data']['id'], name='Updated group') | ||
print(groups.get(id=new_group['data']['id'])) | ||
groups.delete(new_group['data']['id']) | ||
|
||
# /incidents | ||
incidents = cachet.Incidents(endpoint=ENDPOINT, api_token=API_TOKEN) | ||
new_incident = json.loads(incidents.post(name='Test incident', | ||
message='Houston, we have a problem.', | ||
status=1)) | ||
print(incidents.get()) | ||
incidents.put(id=new_incident['id'], | ||
incidents.put(id=new_incident['data']['id'], | ||
message="There's another problem, Houston.") | ||
print(incidents.get(id=new_incident['id'])) | ||
incidents.delete(id=new_incident['id']) | ||
print(incidents.get(id=new_incident['data']['id'])) | ||
incidents.delete(id=new_incident['data']['id']) | ||
|
||
# /metrics | ||
# /metrics/points | ||
|
@@ -64,16 +64,17 @@ | |
description='How many numbers per hour', | ||
default_value=0)) | ||
print(metrics.get()) | ||
print(metrics.get(id=new_metric['id'])) | ||
print(metrics.get(id=new_metric['data']['id'])) | ||
|
||
points = cachet.Points(endpoint=ENDPOINT, api_token=API_TOKEN) | ||
new_point = json.loads(points.post(id=new_metric['id'], value=5)) | ||
print(points.get(metric_id=new_metric['id'])) | ||
new_point = json.loads(points.post(id=new_metric['data']['id'], value=5)) | ||
print(points.get(metric_id=new_metric['data']['id'])) | ||
|
||
points.delete(metric_id=new_metric['id'], point_id=new_point['id']) | ||
metrics.delete(id=new_metric['id']) | ||
points.delete(metric_id=new_metric['data']['id'], | ||
point_id=new_point['data']['id']) | ||
metrics.delete(id=new_metric['data']['id']) | ||
|
||
# /subscribers | ||
subscribers = cachet.Subscribers(endpoint=ENDPOINT, api_token=API_TOKEN) | ||
new_subscriber = json.loads(subscribers.post(email='[email protected]')) | ||
subscribers.delete(id=new_subscriber['id']) | ||
subscribers.delete(id=new_subscriber['data']['id']) |