Skip to content

Commit

Permalink
Tests for checking path param in metadata form
Browse files Browse the repository at this point in the history
  • Loading branch information
claravox authored Jan 10, 2024
1 parent 19ed0bb commit bc3b6e7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,3 +365,8 @@ def ui_module_shown(browser, module):
@when(parsers.parse("the user navigates to {page}"))
def ui_login_visit_groupmngr(browser, page):
browser.visit("{}{}".format(portal_url, page))


@then('the 404 error page is shown')
def ui_404_error(browser):
browser.is_text_present("Page not found")
2 changes: 1 addition & 1 deletion tests/features/api/api_deposit_restricted.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Deposit API (restricted)
Then the response status code is "200"

Examples:
| file |
| file |
| deposit_restricted_test_file1.txt |
| deposit_restricted_test_file2.txt |
| deposit_restricted_test_file3.txt |
Expand Down
10 changes: 10 additions & 0 deletions tests/features/ui/ui_meta.feature
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,13 @@ Feature: Meta UI
Examples:
| folder |
| research-default-3 |


Scenario Outline: Check that path is safe
Given user researcher is logged in
When the user navigates to <page>
Then the 404 error page is shown

Examples:
| page |
| /research/metadata/form?path=<script>alert(document.domain)</script> |
6 changes: 0 additions & 6 deletions tests/step_defs/ui/test_ui_browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@

from pytest_bdd import (
scenarios,
then,
)

scenarios('../../features/ui/ui_browse.feature')


@then('the 404 error page is shown')
def ui_browse_404(browser):
browser.is_text_present("Page not found")

0 comments on commit bc3b6e7

Please sign in to comment.