Don't accept token flag on download command#631
Merged
Conversation
added 4 commits
July 14, 2018 00:30
Put the helper methods and fixtures at the bottom of the file.
The various command tests need different types of mock servers. These all live in the same namespace, despite being defined in different files. The download command test had a 'makeMockServer' function, which in the scope of the entire cmd package is not specific enough. This renames it to fakeDownloadServer which follows the pattern used in the submit test (fakeSubmitServer). I prefer that the name reflect _what it returns_ rather than _what you are asking it to do_. So for something that returns a _thing_, I'd rather it be named _thing_ than _make thing_.
We need to know who you are in order to download the correct exercise with all the requisite metadata. Originally the download command allowed you to pass a token on the fly, during download. That added a lot of complexity, so instead we bail with a helpful error message that explains how to configure the client.
nywilken
reviewed
Jul 14, 2018
| } | ||
| if usrCfg.Token == "" { | ||
| tokenURL := config.InferSiteURL(usrCfg.APIBaseURL) + "/my/settings" | ||
| return fmt.Errorf(msgWelcomePleaseConfigure, tokenURL, BinaryName) |
Contributor
There was a problem hiding this comment.
If a user calls this for the first time without having run configure ever tokenURL is empty. Now that we have made the migration should it just be https://exercism.io/my/settings? Or do we still want to try an infer the Token URL?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We need to know who you are in order to download the correct exercise with all the requisite
metadata.
Originally the download command allowed you to pass a token on the fly, during download.
That added a lot of complexity. This changes it so that we instead bail with a helpful error message
that explains how to configure the client.
The error message is the same as the one we are using for the submit command. I moved the error message to a constant. I'm not convinced this is the right choice, but it is one which will be cheap to back out of if we decide to.
My goal for today is to do the same sort of simplification/cleanup in download as I recently did in submit. I'm going to merge this to provide a basis for the next changes, but as with all of the changes in the last couple of weeks, feedback, thoughts, and ideas are very welcome.
Closes #544