Fix token command for non default ports #2357

Merged
merged 2 commits into from Jul 14, 2015

Projects

None yet

3 participants

@seanh
Contributor
seanh commented Jul 13, 2015

Also improve the docs

Sean Hammond Make the `hypothesis token` command work for non-default ports
This enables:

    hypothesis token --base 'http://localhost:5000' --sub 'acct:seanh@127.0.0.1' conf/development.ini

to generate an auth token for h running on port 5000.
44e2e0e
@seanh
Contributor
seanh commented Jul 13, 2015
@seanh
Contributor
seanh commented Jul 13, 2015

Wondering about adding a mention of this command to our API docs in api.rst as well. It's only useful to developers working on their local instance as far as I can see (you have to pass the paster config file to the command), but at least those devs will be able to find it

@tilgovi
Contributor
tilgovi commented Jul 13, 2015

Is the indentation on that docstring strange?

@nickstenning nickstenning commented on an outdated diff Jul 13, 2015
@@ -118,12 +133,18 @@ def token(args):
print(token)
-parser_token = subparsers.add_parser('token', help=token.__doc__)
+parser_token = subparsers.add_parser(
+ 'token', description=token.__doc__,
@nickstenning
nickstenning Jul 13, 2015 Member

If you could employ textwrap.dedent here (c.f. hypothesis-buildext) and reformat the docstring to look a little more conventional, that would make me happy :).

@nickstenning nickstenning commented on an outdated diff Jul 13, 2015
@@ -98,15 +103,25 @@ def reindex(args):
def token(args):
- """Generate an OAuth bearer token for the specified principal."""
+ """Generate an OAuth bearer token for the specified principal.
+
+This token is suitable for passing to the h API as the value of an
+X-Annotator-Auth-Token header.
+
+For example, to authorize yourself as user seanh to your local dev instance
+of h do:
+
+ hypothesis token --base 'http://localhost:5000' --sub 'acct:seanh@127.0.0.1' conf/development.ini
@nickstenning
nickstenning Jul 13, 2015 Member

Also this should probably read "localhost" not "127.0.0.1".

@seanh seanh self-assigned this Jul 14, 2015
@seanh seanh added the WIP label Jul 14, 2015
Sean Hammond Improve the `hypothesis token -h` help text
21d0184
@seanh seanh removed the WIP label Jul 14, 2015
@seanh seanh removed their assignment Jul 14, 2015
@nickstenning nickstenning merged commit 390d4be into master Jul 14, 2015

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.02%) to 58.465%
Details
@nickstenning nickstenning deleted the fix-token-command-for-non-default-ports branch Jul 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment