Skip to content
This repository has been archived by the owner on Aug 4, 2019. It is now read-only.

Commit

Permalink
Generating markdown while running tests, #51
Browse files Browse the repository at this point in the history
  • Loading branch information
pylover committed Apr 24, 2018
1 parent 11c22d0 commit aee004e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'oathcy >= 1.0.1a2',
'pycrypto',

'bddrest',
'bddrest >= 0.11.0b2',
# deployment
'gunicorn',
]
Expand Down
20 changes: 18 additions & 2 deletions wolf/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,38 @@ def login(self, username, password):
@classmethod
def get_spec_filename(cls, story: Composer):
filename = f'{story.base_call.verb}-{story.base_call.url.split("/")[2]}({story.title})'
target = path.abspath(path.join(HERE, '../../data'))
target = path.abspath(path.join(HERE, '../../data/specifications'))
if not path.exists(target):
makedirs(target, exist_ok=True)
filename = path.join(target, f'{filename}.yml')
return filename

@classmethod
def get_markdown_filename(cls, story: Composer):
filename = f'{story.base_call.verb}-{story.base_call.url.split("/")[2]}({story.title})'
target = path.abspath(path.join(HERE, '../../data/documentation'))
if not path.exists(target):
makedirs(target, exist_ok=True)
filename = path.join(target, f'{filename}.md')
return filename

def logout(self):
self.wsgi_app.jwt_token = ''

def given(self, *args, **kwargs):
if self.wsgi_app.jwt_token:
headers = kwargs.setdefault('headers', [])
headers.append(('AUTHORIZATION', self.wsgi_app.jwt_token))
return given(self.application, autodump=self.get_spec_filename, *args, **kwargs)
return given(
self.application,
autodump=self.get_spec_filename,
autodoc=self.get_markdown_filename,
*args,
**kwargs
)


# FIXME: remove it
class DocumentaryMiddleware(FileDocumentaryMiddleware):
def __init__(self, application):
directory = settings.documentary.source_directory
Expand Down

0 comments on commit aee004e

Please sign in to comment.