-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
permission RAML test and stringifies filters in mongo
- Loading branch information
Showing
8 changed files
with
139 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[{ | ||
"label": "Test Search", | ||
"_id": "57e452791cff88b85f9f9c23" | ||
}] |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"label": "Test Search", | ||
"_id": "57e452791cff88b85f9f9c23", | ||
"search": { | ||
"return_type": "file", | ||
"filters": [{"terms": {"file.type":["nifti"]}}] | ||
}, | ||
"permissions": [{"access": "admin", "_id": "[email protected]"}], | ||
"creator": "[email protected]" | ||
} |
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 |
---|---|---|
|
@@ -24,6 +24,8 @@ var delete_project_id = ''; | |
var device_id = 'bootstrapper_Bootstrapper'; | ||
var injected_api_key = 'XZpXI40Uk85eozjQkU1zHJ6yZHpix+j0mo1TMeGZ4dPzIqVPVGPmyfeK'; | ||
var search_id = ''; | ||
var delete_search_id = ''; | ||
var user_id = '[email protected]' | ||
|
||
// Tests we're skipping, fix these | ||
|
||
|
@@ -1474,7 +1476,7 @@ hooks.before("POST /savesearches -> 200", function(test, done) { | |
done(); | ||
}) | ||
hooks.after("POST /savesearches -> 200", function(test, done) { | ||
search_id = test.response.body['_id']; | ||
delete_search_id = test.response.body['_id']; | ||
done(); | ||
}) | ||
|
||
|
@@ -1485,6 +1487,11 @@ hooks.before("POST /savesearches -> 400", function(test, done) { | |
done(); | ||
}) | ||
|
||
hooks.after("GET /savesearches -> 200", function(test, done) { | ||
search_id = test.response.body[0]._id; | ||
done(); | ||
}) | ||
|
||
hooks.before("GET /savesearches/{SearchId} -> 200", function(test, done) { | ||
test.request.params = { | ||
SearchId: search_id | ||
|
@@ -1516,9 +1523,69 @@ hooks.before("POST /savesearches/{SearchId} -> 400", function(test, done) { | |
done(); | ||
}) | ||
|
||
hooks.before("DELETE /savesearches/{SearchId} -> 200", function(test, done) { | ||
hooks.before("POST /savesearches/{SearchId}/permissions -> 200", function(test, done) { | ||
test.request.params = { | ||
SearchId: search_id | ||
}; | ||
test.request.body = { | ||
"access" : "admin", | ||
"_id": user_id | ||
}; | ||
done(); | ||
}) | ||
|
||
hooks.before("POST /savesearches/{SearchId}/permissions -> 400", function(test, done) { | ||
test.request.params = { | ||
SearchId: search_id | ||
}; | ||
test.request.body = { | ||
"not-access" : "admin", | ||
"not_id": user_id | ||
}; | ||
done(); | ||
}) | ||
|
||
hooks.before("GET /savesearches/{SearchId}/permissions/{UserId} -> 200", function(test, done) { | ||
test.request.params = { | ||
SearchId: search_id, | ||
UserId: user_id | ||
}; | ||
done(); | ||
}) | ||
|
||
hooks.before("PUT /savesearches/{SearchId}/permissions/{UserId} -> 200", function(test, done) { | ||
test.request.params = { | ||
SearchId: search_id, | ||
UserId: user_id | ||
}; | ||
test.request.body = { | ||
"access" : "ro" | ||
}; | ||
done(); | ||
}) | ||
|
||
hooks.before("PUT /savesearches/{SearchId}/permissions/{UserId} -> 400", function(test, done) { | ||
test.request.params = { | ||
SearchId: search_id, | ||
UserId: user_id | ||
}; | ||
test.request.body = { | ||
"access" : "not_an_access_level" | ||
}; | ||
done(); | ||
}) | ||
|
||
hooks.before("DELETE /savesearches/{SearchId}/permissions/{UserId} -> 200", function(test, done) { | ||
test.request.params = { | ||
SearchId: search_id, | ||
UserId: user_id | ||
}; | ||
done(); | ||
}) | ||
|
||
hooks.before("DELETE /savesearches/{SearchId} -> 200", function(test, done) { | ||
test.request.params = { | ||
SearchId: delete_search_id | ||
}; | ||
done(); | ||
}) |
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