Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_versions_exist(self):
with git_utils.Commit('gh-pages', 'add versions.json') as commit:
commit.add_file(git_utils.FileInfo(
'versions.json',
'[{"version": "1.0", "title": "1.0", "aliases": []}]',
))
self.assertEqual(list(commands.list_versions()), [
versions.VersionInfo('1.0'),
])
def _deploy(self, branch='gh-pages'):
commands.deploy(self.stage, '1.0', aliases=['stable'], branch=branch)
commands.deploy(self.stage, '2.0', branch=branch)
def test_serve(self):
class MyMockServer(MockServer):
def serve_forever(self):
self.handle_request(MockRequest())
raise KeyboardInterrupt()
handler_name = 'mike.server.GitBranchHTTPHandler'
with mock.patch('http.server.HTTPServer', MyMockServer), \
mock.patch(handler_name + '.wbufsize', -1), \
mock.patch(handler_name + '.log_message') as m: # noqa
commands.serve(branch='branch', verbose=False)
self.assertEqual(m.call_args[0][1:3], ('GET / HTTP/1.1', '200'))
def test_nonexistent(self):
commands._makedirs('dir')
assertDirectory('.', {'dir'})
def test_versions_nonexistent(self):
self.assertEqual(list(commands.list_versions()), [])
def deploy(args):
check_remote_status(args, strict=True)
mkdocs.build(args.config_file)
commands.deploy(mkdocs.site_dir(args.config_file), args.version,
args.title, args.alias, args.update_aliases, args.branch,
args.message)
if args.push:
git_utils.push_branch(args.remote, args.branch, args.force)
def serve(args):
check_remote_status(args)
commands.serve(args.dev_addr, args.branch)