|
29 | 29 |
|
30 | 30 | # /components |
31 | 31 | components = cachet.Components(endpoint=ENDPOINT, api_token=API_TOKEN) |
| 32 | +print(components.get()) |
32 | 33 | new_component = json.loads(components.post(name='Test component', |
33 | 34 | status=1, |
34 | 35 | description='Test component')) |
| 36 | +components.put(id=new_component['id'], description='Updated component') |
35 | 37 | print(components.get(id=new_component['id'])) |
36 | | -print(components.put(id=new_component['id'], description='Updated component')) |
37 | 38 | components.delete(id=new_component['id']) |
38 | 39 |
|
39 | 40 | # /components/groups |
40 | 41 | groups = cachet.Groups(endpoint=ENDPOINT, api_token=API_TOKEN) |
| 42 | +print(groups.get()) |
41 | 43 | new_group = json.loads(groups.post(name='Test group')) |
| 44 | +groups.put(id=new_group['id'], name='Updated group') |
42 | 45 | print(groups.get(id=new_group['id'])) |
43 | | -print(groups.put(id=new_group['id'], name='Updated group')) |
44 | 46 | groups.delete(new_group['id']) |
45 | 47 |
|
46 | 48 | # /incidents |
47 | 49 | incidents = cachet.Incidents(endpoint=ENDPOINT, api_token=API_TOKEN) |
| 50 | +print(incidents.get()) |
48 | 51 | new_incident = json.loads(incidents.post(name='Test incident', |
49 | 52 | message='Houston, we have a problem.', |
50 | 53 | status=1)) |
| 54 | +incidents.put(id=new_incident['id'], |
| 55 | + message="There's another problem, Houston.") |
51 | 56 | print(incidents.get(id=new_incident['id'])) |
52 | | -print(incidents.put(id=new_incident['id'], |
53 | | - message="There's another problem, Houston.")) |
54 | 57 | incidents.delete(id=new_incident['id']) |
55 | 58 |
|
56 | 59 | # /metrics |
57 | 60 | # /metrics/points |
58 | 61 | metrics = cachet.Metrics(endpoint=ENDPOINT, api_token=API_TOKEN) |
| 62 | +print(metrics.get()) |
59 | 63 | new_metric = json.loads(metrics.post(name='Test metric', |
60 | 64 | suffix='Numbers per hour', |
61 | 65 | description='How many numbers per hour', |
62 | 66 | default_value=0)) |
63 | 67 | print(metrics.get(id=new_metric['id'])) |
| 68 | + |
64 | 69 | points = cachet.Points(endpoint=ENDPOINT, api_token=API_TOKEN) |
65 | 70 | new_point = json.loads(points.post(id=new_metric['id'], value=5)) |
66 | | -print(points.get(metric_id=new_metric['id'], point_id=new_point['id'])) |
| 71 | +print(points.get(metric_id=new_metric['id'])) |
| 72 | + |
67 | 73 | points.delete(metric_id=new_metric['id'], point_id=new_point['id']) |
68 | 74 | metrics.delete(id=new_metric['id']) |
69 | 75 |
|
|
0 commit comments