diff --git a/tests/test_cli.py b/tests/test_cli.py index 3920390..5da7e2c 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -19,6 +19,12 @@ def test_jwtcli(): assert status == 0 assert len(stdout.split('.')) == 3 + # Without token + when('auth create') + assert stderr == '' + assert status == 0 + assert len(stdout.split('.')) == 3 + if __name__ == '__main__': app.climain(['auth', 'c', '{"foo": "bar"}']) diff --git a/yhttp/ext/auth/__init__.py b/yhttp/ext/auth/__init__.py index 5b4b44b..62dcf40 100644 --- a/yhttp/ext/auth/__init__.py +++ b/yhttp/ext/auth/__init__.py @@ -2,4 +2,4 @@ from .install import install from .authentication import Authenticator -__version__ = '3.7.0' +__version__ = '3.7.1' diff --git a/yhttp/ext/auth/cli.py b/yhttp/ext/auth/cli.py index 4983cef..6883666 100644 --- a/yhttp/ext/auth/cli.py +++ b/yhttp/ext/auth/cli.py @@ -16,7 +16,12 @@ class Create(SubCommand): def __call__(self, args): settings = args.application.settings.auth jwt = Authenticator(settings) - print(jwt.dump(json.loads(args.payload))) + if args.payload: + payload = json.loads(args.payload) + else: + payload = '' + + print(jwt.dump(payload)) class AuthenticatorCLI(SubCommand):