Skip to content

Commit

Permalink
[ci][webui] add test case for permission handling when adding DoD URL
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Nov 17, 2015
1 parent ae338ad commit 4f9057a
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions src/api/test/functional/webui/project_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,6 @@ def test_save_meta_permission_check
# Test reading meta data
click_link("Advanced")
click_link("Meta")
# Note that textarea#editor_0 is a hidden element.
# This isn't ideal for a test, but best we can do to test this part of the ui
assert find(:css, "textarea#editor_0", visible: false).
text(:all).include?("<title>adrian's Home Project</title>")

# Test writing valid meta data
xml = <<-XML.gsub(/(?:\s*\n|^\s*)/, '') # evaluate_script fails otherwise
Expand All @@ -346,6 +342,32 @@ def test_save_meta_permission_check

# not saved
assert_nil Project.find_by_name("home:adrian").remoteurl

# same with download url in repo
visit(project_show_path(project: "home:adrian"))

# Test reading meta data
click_link("Advanced")
click_link("Meta")

# Test writing valid meta data
xml = <<-XML.gsub(/(?:\s*\n|^\s*)/, '') # evaluate_script fails otherwise
<project name='home:adrian'>
<title>My Home Project</title>
<description/>
<person userid='adrian' role='maintainer'/>
<repository name='standard'>
<download arch='x86_64' url='http://somewhere/' repotype='rpmmd'/>
</repository>
</project>
XML
# Workaround. There doesn't seem to be a way to change stored meta content via the textarea.
page.evaluate_script("editors[0].setValue(\"#{xml}\");")
click_button("Save")
find(:id, 'flash-messages').must_have_text("Admin rights are required to change projects using remote resources")

# not saved
assert_nil Project.find_by_name("home:adrian").remoteurl
end

def test_list_all
Expand Down

0 comments on commit 4f9057a

Please sign in to comment.