forked from ontoportal/ontologies_api
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update slices controller to enforce admin security
- Loading branch information
1 parent
f7c19ec
commit 5857f60
Showing
4 changed files
with
27 additions
and
13 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
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 |
---|---|---|
|
@@ -3,11 +3,19 @@ | |
class TestSlicesController < TestCase | ||
|
||
def self.before_suite | ||
onts = LinkedData::SampleData::Ontology.create_ontologies_and_submissions(ont_count: 1, submission_count: 0)[2] | ||
ont_count, ont_acronyms, @@onts = LinkedData::SampleData::Ontology.create_ontologies_and_submissions(ont_count: 1, submission_count: 0) | ||
|
||
@@slice_acronyms = ["tst-a", "tst-b"].sort | ||
_create_slice(@@slice_acronyms[0], "Test Slice A", onts) | ||
_create_slice(@@slice_acronyms[1], "Test Slice B", onts) | ||
_create_slice(@@slice_acronyms[0], "Test Slice A", @@onts) | ||
_create_slice(@@slice_acronyms[1], "Test Slice B", @@onts) | ||
|
||
@@user = User.new({ | ||
username: "test-slice", | ||
email: "[email protected]", | ||
password: "12345" | ||
}).save | ||
@@new_slice_data = { acronym: 'tst-c', name: "Test Slice C", ontologies: ont_acronyms} | ||
@@old_security_setting = LinkedData.settings.enable_security | ||
end | ||
|
||
def self.after_suite | ||
|
@@ -26,7 +34,7 @@ def test_all_slices | |
get "/slices" | ||
assert last_response.ok? | ||
slices = MultiJson.load(last_response.body) | ||
assert_equal @@slice_acronyms, slices.map {|s| s["acronym"]}.sort | ||
assert_equal @@slice_acronyms, slices.map { |s| s["acronym"] }.sort | ||
end | ||
|
||
def test_create_slices | ||
|
@@ -61,11 +69,11 @@ def test_delete_slices | |
|
||
def self._create_slice(acronym, name, ontologies) | ||
slice = LinkedData::Models::Slice.new({ | ||
acronym: acronym, | ||
name: "Test #{name}", | ||
ontologies: ontologies | ||
}) | ||
acronym: acronym, | ||
name: "Test #{name}", | ||
ontologies: ontologies | ||
}) | ||
slice.save | ||
end | ||
|
||
end | ||
end |