Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Mar 18, 2019. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 openapi_codec/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def generate_swagger_object(document):
swagger['info'] = OrderedDict()
swagger['info']['title'] = document.title
swagger['info']['version'] = '' # Required by the spec
swagger['info']['description'] = document.description

if parsed_url.netloc:
swagger['host'] = parsed_url.netloc
Expand Down
18 changes: 17 additions & 1 deletion 18 tests/test_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def test_info(self):
self.assertIn('info', self.swagger)
expected = {
'title': self.document.title,
'version': ''
'version': '',
'description': ''
}
self.assertEquals(self.swagger['info'], expected)

Expand All @@ -33,6 +34,21 @@ def test_schemes(self):
self.assertEquals(self.swagger['schemes'], expected)


class TestInfoDescription(TestCase):
def setUp(self):
self.document = coreapi.Document(title='Example API', url='https://www.example.com/', description='Welcome to API Docs')
self.swagger = generate_swagger_object(self.document)

def test_info(self):
self.assertIn('info', self.swagger)
expected = {
'title': self.document.title,
'version': '',
'description': self.document.description
}
self.assertEquals(self.swagger['info'], expected)


class TestPaths(TestCase):
def setUp(self):
self.path = '/users/'
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.