Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@only_python_3_5
@pytest.mark.parametrize(
'status_code, latest_release',
product([200, 404], [True, False])
)
def test_check_upstream_release(status_code, latest_release):
"""test func."""
resp = mock.Mock()
resp.status = status_code
m_manager = mock.Mock()
m_manager.request.return_value = resp
with mock.patch('buku.urllib3') as m_urllib3, \
mock.patch('buku.print') as m_print:
import buku
if latest_release:
latest_version = 'v{}'.format(buku.__version__)
else:
latest_version = 'v0'
m_urllib3.PoolManager.return_value = m_manager
resp.data.decode.return_value = json.dumps([{'tag_name': latest_version}])
buku.check_upstream_release()
if status_code != 200:
return
len(m_print.mock_calls) == 1
def get_custom_version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
message = '%(app_name)s %(app_version)s\nFlask %(version)s\nPython %(python_version)s'
click.echo(message % {
'app_name': 'Buku',
'app_version': __version__,
'version': flask_version,
'python_version': sys.version,
}, color=ctx.color)
ctx.exit()