Dump & Load User API Tokens#230
Conversation
- Dump and load user api tokens.
- Dump and load user api tokens.
|
@wardi okay I think this makes more sense now. I also adding in a pop on the |
- Added new options to tests.
|
Tests updated now too |
- Added new options to tests.
|
A small test with mocked actions would be good to make sure this feature keeps working |
- Added new options to tests.
|
@wardi okay I have tests from dumping users, dumping users w/ api tokens, and loading users. I could not figure out coverage for loading users with tokens as the create api token action does model.User.get instead of user_show action so not sure how to mock that up |
- Added new options to tests.
- Added new options to tests.
- Added new options to tests.
- Added new options to tests.
|
@wardi okay I did the load api tokens test. And now log out the loaded tokens by name. Which I guess begs a new question, should I be handling the tokens that could not load and list them as skipped tokens? Like for ValidationErrors on token name already existing? |
- Added new options to tests.
| except CKANAPIError: | ||
| return | ||
| except NotFound: | ||
| return # with localckan we'll get the real CKAN exception not a CKANAPIError subclass |
There was a problem hiding this comment.
The way this is written multiple exceptions would be caught in the RemoteCKAN case but only NotFound will be caught in the LocalCKAN case, that's strange.
| except CKANAPIError: | |
| return | |
| except NotFound: | |
| return # with localckan we'll get the real CKAN exception not a CKANAPIError subclass | |
| except NotFound: | |
| return # with localckan we'll get the real CKAN exception not a CKANAPIError subclass |
But, would we ever expect a NotFound? Won't that only happen if the user doesn't exist? If so it's better to not catch and ignore any exceptions.
There was a problem hiding this comment.
But, I'll merge as-is and we can clean it up later.
Allows dumping and loading of user api tokens.
req: ckan/ckan#9339
cc: @wardi