Skip to content

Commit

Permalink
allow __version__ to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
gabisurita committed Dec 15, 2016
1 parent e9c38b1 commit 1b13119
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
20 changes: 17 additions & 3 deletions swagger.yaml
Expand Up @@ -42,6 +42,7 @@ securityDefinitions:
security:
- basicAuth: []


# May be overwritten in methods
consumes:
- application/json
Expand Down Expand Up @@ -74,6 +75,8 @@ paths:
responses:
'200':
$ref: '#/responses/server-info'
default:
$ref: '#/responses/default'

'/__heartbeat__':
get:
Expand All @@ -96,6 +99,7 @@ paths:
type: boolean
additionalProperties:
type: boolean

'503':
description: One or more systems are failing.
schema:
Expand All @@ -109,6 +113,8 @@ paths:
type: boolean
additionalProperties:
type: boolean
default:
$ref: '#/responses/default'

'/__lbheartbeat__':
get:
Expand All @@ -121,6 +127,8 @@ paths:
description: Returns empty object.
schema:
type: object
default:
$ref: '#/responses/default'

'/__version__':
get:
Expand All @@ -135,6 +143,10 @@ paths:
type: object
'404':
description: version.json file not found.
schema:
$ref: '#/definitions/Error'
default:
$ref: '#/responses/default'

'/contribute.json':
get:
Expand All @@ -147,12 +159,13 @@ paths:
description: Open source contribution information.
schema:
type: object

default:
$ref: '#/responses/default'
#
# Batch requests
#

/batch:
'/batch':
post:
tags:
- Batch
Expand All @@ -165,7 +178,8 @@ paths:
$ref: '#/responses/batch-200'
'400':
$ref: '#/responses/batch-400'

default:
$ref: '#/responses/default'
#
# Data endpoints
#
Expand Down
15 changes: 10 additions & 5 deletions tests/swagger/test_resources.py
Expand Up @@ -9,9 +9,11 @@

class SwaggerResourcesTest(SwaggerTest):

allowed_failures = ['__version__']

def test_existing_path(self):
for resource in self.resources.values():
for op in resource.operations.values():
for op_id, op in resource.operations.items():
self.setUp()
self.request.path = {
'bucket_id': 'b1',
Expand All @@ -20,13 +22,16 @@ def test_existing_path(self):
'record_id': 'r1'
}
resp = self.validate_request_call(op, expect_errors=True)
# Method must exist (404 and 405 means it might not exist)
self.assertIn(resp.status_int, [200, 201, 400])

if op_id not in self.allowed_failures:
# Method must exist (404 and 405 means it might not exist)
self.assertIn(resp.status_int, [200, 201, 400])

def test_resource_utilities(self):
resource = self.resources['Utilities']
for op in resource.operations.values():
self.validate_request_call(op)
for op_id, op in resource.operations.items():
if op_id not in self.allowed_failures:
self.validate_request_call(op)

def test_resource_batch(self):
resource = self.resources['Batch']
Expand Down

0 comments on commit 1b13119

Please sign in to comment.