-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds monitoring user and access token for setup. Co-Authored-by: Peter Weber <[email protected]>
- Loading branch information
Showing
7 changed files
with
142 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,13 @@ invenio access allow admin-access role moderator | |
invenio access allow admin-access role submitter | ||
message "Done" "success" | ||
|
||
section "Create user for monitoring" "info" | ||
invenio users create --active --confirm --password monitor [email protected] | ||
invenio roles create monitoring | ||
invenio roles add [email protected] monitoring | ||
# create token access for monitoring | ||
token_create monitoring [email protected] ${INVENIO_RERO_ACCESS_TOKEN_MONITORING} | ||
|
||
# Create a default location for depositing files | ||
section "Create location for storing files" "info" | ||
invenio fixtures deposits create | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
from io import BytesIO | ||
from os.path import isdir | ||
|
||
import invenio_accounts.cli as CliUsers | ||
from click.testing import CliRunner | ||
from invenio_search.cli import destroy | ||
|
||
|
@@ -90,3 +91,27 @@ def test_export(app, script_info, document, organisation): | |
['--pid-type', 'org', '--output-dir', '/tmp/org'], | ||
obj=script_info) | ||
assert result.output.find('Export "org" records') != -1 | ||
|
||
|
||
def test_cli_access_token(app, script_info): | ||
"""Test access token cli.""" | ||
runner = CliRunner() | ||
email = '[email protected]' | ||
res = runner.invoke( | ||
CliUsers.users_create, | ||
['--active', '--confirm', '--password', 'PWD_TEST', email], | ||
obj=script_info | ||
) | ||
res = runner.invoke( | ||
Cli.token_create, | ||
['-n', 'test_good', '-u', email, '-t', 'my_token'], | ||
obj=script_info | ||
) | ||
assert res.output.strip().split('\n') == ['my_token'] | ||
|
||
res = runner.invoke( | ||
Cli.token_create, | ||
['-n', 'test_fail', '-u', '[email protected]', '-t', 'my_token'], | ||
obj=script_info | ||
) | ||
assert res.output.strip().split('\n') == ['No user found'] |