Skip to content

Commit

Permalink
Fix Fake API response for /api/v1/status/<period>
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Maretskiy committed Dec 6, 2016
1 parent 89c8e43 commit a32861a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
13 changes: 12 additions & 1 deletion ceagle/api_fake_data/fake_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,18 @@ def generate_region_data_response(region, period, service=None):

@base.api_handler
def get_status(period):
return generate_status_data(period)
if not period_is_valid(period):
flask.abort(404)
regions = {}
for name, data in fake_regions.regions(detailed=True).items():
regions[name] = {}
for svc in data["services"]:
if svc == "performance":
value = int(base.randnum(100, 250))
else:
value = base.randnum(.7, 1)
regions[name][svc] = value
return flask.jsonify({"regions": regions, "period": period})


@base.api_handler
Expand Down
2 changes: 1 addition & 1 deletion raml/api.raml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ mediaType: application/json
body:
application/json:
schema: schemas/200.json
example: !include response_examples/200/status_region.json
example: !include response_examples/200/status.json

/status/health/{period}:
uriParametrs:
Expand Down
1 change: 0 additions & 1 deletion raml/response_examples/200/status.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"period": "week",

"regions": {
"west-1.hooli.net": {
"sla": 0.9,
Expand Down

0 comments on commit a32861a

Please sign in to comment.