Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2878] Changes to model to allow permission to appear in more than on…
…e place. - Also added a test and the organization_role_create action.
- Loading branch information
Showing
8 changed files
with
149 additions
and
16 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
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from nose.tools import assert_equal | ||
from pylons import config | ||
import pylons.test | ||
import paste | ||
|
||
from ckan.lib.create_test_data import CreateTestData | ||
import ckan.lib.helpers as h | ||
import ckan.model as model | ||
|
||
_json = h.json | ||
|
||
class TestUserController(object): | ||
|
||
@classmethod | ||
def setup_class(cls): | ||
CreateTestData.create() | ||
cls.app = paste.fixture.TestApp(pylons.test.pylonsapp) | ||
cls.sysadmin_user = model.User.get('testsysadmin') | ||
cls.extra_environ = {'Authorization' : str(cls.sysadmin_user.apikey)} | ||
|
||
p = model.Permission(name="package.view") | ||
model.Session.add(p) | ||
model.Session.commit() | ||
|
||
@classmethod | ||
def teardown_class(self): | ||
model.repo.rebuild_db() | ||
|
||
def test_role_create(self): | ||
params = _json.dumps({'name':'test_role', 'permissions': [{"name":"package.view"}]}) | ||
|
||
response = self.app.post('/api/action/organization_role_create', | ||
params=params, extra_environ=self.extra_environ).json | ||
assert response['success'] is True | ||
print response |