[ckan-changes] commit/ckan: John Lawrence Aspden: [authz][s]: code tidying
Bitbucket
commits-noreply at bitbucket.org
Mon May 16 17:41:51 UTC 2011
1 new changeset in ckan:
http://bitbucket.org/okfn/ckan/changeset/680d24d106a0/
changeset: r3088:680d24d106a0
branch: feature-1074-authz-wui
user: John Lawrence Aspden
date: 2011-05-16 19:41:31
summary: [authz][s]: code tidying
affected #: 1 file (8 bytes)
--- a/ckan/tests/functional/test_package_edit_authz.py Mon May 16 18:24:06 2011 +0100
+++ b/ckan/tests/functional/test_package_edit_authz.py Mon May 16 18:41:31 2011 +0100
@@ -23,11 +23,6 @@
checkbox.checked=set_to
return theform
-def package_roles(pkgname):
- pkg = model.Package.by_name(pkgname)
- list = [ (r.user.name, r.role) for r in pkg.roles if r.user]
- list.extend([(r.authorized_group.name, r.role) for r in pkg.roles if r.authorized_group])
- return list
class TestPackageEditAuthz(TestController):
@classmethod
@@ -94,10 +89,28 @@
# all the package's users and roles should appear in tables
assert '<tr' in res
- for (user,role) in package_roles(self.pkgname):
+ for (user,role) in self.package_roles():
assert user in res
assert role in res
+
+ def package_roles(self):
+ pkg = model.Package.by_name(self.pkgname)
+ list = [ (r.user.name, r.role) for r in pkg.roles if r.user]
+ list.extend([(r.authorized_group.name, r.role) for r in pkg.roles if r.authorized_group])
+ return list
+
+ def assert_package_roles_to_be(self, roles_list):
+ prs=self.package_roles()
+ ok = ( len(prs) == len(roles_list) )
+ for r in roles_list:
+ if not r in prs:
+ ok = False
+ if not ok:
+ print "expected roles: ", roles_list
+ print "actual roles: ", prs
+ assert False, "roles not as expected"
+
def change_roles(self, user):
# load authz page
offset = url_for(controller='package', action='authz', id=self.pkgname)
@@ -241,19 +254,6 @@
self.delete_role_as(self.sysadmin)
- def assert_package_roles_to_be(self, roles_list):
- prs=package_roles(self.pkgname)
- ok = ( len(prs) == len(roles_list) )
- for r in roles_list:
- if not r in prs:
- ok = False
-
- if not ok:
- print "expected roles: ", roles_list
- print "actual roles: ", prs
- assert False, "roles not as expected"
-
-
def test_5_add_change_delete_authzgroup(self):
user=self.admin
Repository URL: https://bitbucket.org/okfn/ckan/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the ckan-changes
mailing list