Skip to content

Don't accept token flag on download command#631

Merged
kytrinyx merged 5 commits intomasterfrom
rm-token-on-download
Jul 14, 2018
Merged

Don't accept token flag on download command#631
kytrinyx merged 5 commits intomasterfrom
rm-token-on-download

Conversation

@kytrinyx
Copy link
Member

@kytrinyx kytrinyx commented Jul 14, 2018

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

Katrina Owen 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.
@kytrinyx kytrinyx requested a review from nywilken July 14, 2018 09:30
@kytrinyx kytrinyx merged commit 0520301 into master Jul 14, 2018
@kytrinyx kytrinyx deleted the rm-token-on-download branch July 14, 2018 10:54
}
if usrCfg.Token == "" {
tokenURL := config.InferSiteURL(usrCfg.APIBaseURL) + "/my/settings"
return fmt.Errorf(msgWelcomePleaseConfigure, tokenURL, BinaryName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants