Module Expr Str Import alias ImportFrom alias ImportFrom alias alias ImportFrom alias alias alias alias alias ImportFrom alias identifier ImportFrom alias ClassDef bases NameLoad body Expr Str Assign NameStore Str Assign NameStore Str Assign NameStore Dict Str Str Assign NameStore Str Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam defaults NameLoad body If NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults Str kwarg body Assign NameStore Call NameLoad NameLoad If CompareIn Str NameLoad body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str If Call NameLoad NameLoad body Expr Call NameLoad NameLoad Str Dict Expr Call NameLoad NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Return Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad kwarg body Return Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad keyword Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad kwarg body Return Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad decorator_list decorator_list FunctionDef arguments args NameParam defaults body Return Call NameLoad decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Return Call NameLoad decorator_list Call AttributeLoad NameLoad attr Str ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr keyword Str Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr keyword Str keyword Str Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr keyword Str keyword Str keyword Str Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr keyword Str keyword Str Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr keyword Str keyword Str Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr attr Expr Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr attr Expr Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr attr Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr keyword Str keyword Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Dict Str Num keyword AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Dict Str Str Str Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr keyword Str keyword Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Dict Str AttributeLoad AttributeLoad NameLoad attr attr keyword AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Dict Str Str Str Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Dict Str AttributeLoad AttributeLoad NameLoad attr attr keyword AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Dict Str AttributeLoad AttributeLoad NameLoad attr attr keyword AttributeLoad NameLoad attr Assign NameStore Dict Str Str Str Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assign AttributeStore AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Dict Str AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Dict Str AttributeLoad AttributeLoad NameLoad attr attr keyword AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword AttributeLoad NameLoad attr keyword NameLoad Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword Str Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list
N/A N/A 
:copyright (c) 2014 - 2016, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Department of Energy) and contributors. All rights reserved.  # NOQA
:author
 N/A json django.test TestCase django.http HttpResponse HttpResponseForbidden seed.lib.superperms.orgs.models ROLE_VIEWER ROLE_MEMBER ROLE_OWNER Organization OrganizationUser seed.landing.models SEEDUser User seed.lib.superperms.orgs decorators FakeRequest N/A object N/A N/A A simple request stub. N/A __name__ FakeRequest N/A method POST N/A META N/A REMOTE_ADDR 127.0.0.1 N/A path fake_login_path N/A body None __init__ N/A N/A self headers N/A None N/A N/A headers N/A N/A N/A N/A N/A self META update headers N/A N/A FakeClient N/A object N/A N/A An extremely light-weight test client. _gen_req N/A N/A self view_func data headers method N/A POST kwargs N/A N/A request N/A FakeRequest headers N/A N/A user kwargs N/A N/A N/A request user N/A N/A kwargs get user N/A N/A callable view_func N/A N/A N/A setattr request GET N/A N/A N/A setattr request method data N/A N/A request body N/A N/A json dumps data N/A N/A view_func request N/A request N/A get N/A N/A self view_func data headers N/A None kwargs N/A N/A N/A N/A self _gen_req view_func data headers method GET kwargs N/A post N/A N/A self view_func data headers N/A None kwargs N/A N/A N/A N/A self _gen_req view_func data headers kwargs N/A N/A _fake_view_no_perm_name N/A N/A request N/A N/A N/A N/A HttpResponse N/A N/A N/A decorators has_perm derp _fake_invite_user N/A N/A request N/A N/A N/A N/A HttpResponse N/A N/A N/A decorators has_perm can_invite_member TestDecorators N/A TestCase N/A setUp N/A N/A self N/A N/A N/A N/A N/A N/A super TestDecorators self setUp N/A N/A self client N/A FakeClient N/A N/A self fake_org N/A N/A N/A Organization objects create name fake org N/A N/A self fake_member N/A N/A N/A User objects create username fake_member email fake_member@asdf.com N/A N/A self fake_superuser N/A N/A N/A User objects create_superuser username fake_super_member password so fake, so real email fake_super_member@asdf.com N/A N/A self fake_owner N/A N/A N/A User objects create username fake_owner email fake_owner@asdf.com N/A N/A self fake_viewer N/A N/A N/A User objects create username fake_viewer email fake_viewer@asdf.com N/A N/A self owner_org_user N/A N/A N/A OrganizationUser objects create user N/A self fake_owner organization N/A self fake_org role_level ROLE_OWNER N/A N/A self member_org_user N/A N/A N/A OrganizationUser objects create user N/A self fake_member organization N/A self fake_org role_level ROLE_MEMBER N/A N/A self viewer_org_user N/A N/A N/A OrganizationUser objects create user N/A self fake_viewer organization N/A self fake_org role_level ROLE_VIEWER N/A N/A self superuser_org_user N/A N/A N/A OrganizationUser objects create user N/A self fake_superuser organization N/A self fake_org role_level ROLE_VIEWER N/A tearDown N/A N/A self N/A N/A N/A WTF DJANGO. N/A N/A N/A N/A N/A N/A User objects all delete N/A N/A N/A N/A N/A N/A Organization objects all delete N/A N/A N/A N/A N/A N/A OrganizationUser objects all delete N/A N/A N/A N/A super TestDecorators self tearDown N/A test_has_perm_w_no_org N/A N/A self N/A N/A N/A We should return BadRequest if there's no org. N/A N/A N/A self client user N/A N/A N/A User objects create username f email d@d.com N/A resp N/A N/A N/A self client post _fake_view_no_perm_name N/A organization_id 0 user N/A N/A self client user N/A error_msg N/A status message error Organization does not exist N/A N/A N/A self assertEqual N/A resp status_code 403 N/A N/A N/A self assertEqual N/A resp __class__ HttpResponseForbidden N/A N/A N/A self assertDictEqual N/A N/A json loads N/A resp content error_msg N/A test_has_perm_user_not_in_org N/A N/A self N/A N/A N/A We should reject requests from a user not in this org. N/A N/A N/A self client user N/A N/A N/A User objects create username f email d@d.com N/A resp N/A N/A N/A self client post _fake_view_no_perm_name N/A organization_id N/A N/A self fake_org pk user N/A N/A self client user N/A error_msg N/A status message error No relationship to organization N/A N/A N/A self assertEqual N/A resp status_code 403 N/A N/A N/A self assertDictEqual N/A N/A json loads N/A resp content error_msg N/A test_has_perm_w_no_perm_name N/A N/A self N/A N/A N/A Default to false if an undefined perm is spec'ed N/A N/A N/A self client user N/A self fake_member N/A resp N/A N/A N/A self client post _fake_view_no_perm_name N/A organization_id N/A N/A self fake_org pk user N/A self fake_member N/A N/A N/A self assertEqual N/A resp status_code 403 N/A test_has_perm_w_super_user N/A N/A self N/A N/A N/A Make sure that a superuser is ignored if setting is True. N/A super_user N/A N/A N/A User objects create username databaser N/A resp N/A N/A N/A self client post _fake_invite_user N/A organization_id N/A N/A self fake_org pk user N/A self fake_member N/A error_msg N/A status message error Permission denied N/A N/A N/A self assertEqual N/A resp status_code 403 N/A N/A N/A self assertDictEqual N/A N/A json loads N/A resp content error_msg N/A N/A super_user is_superuser True N/A N/A N/A super_user save N/A N/A N/A self client user super_user N/A resp N/A N/A N/A self client post _fake_invite_user N/A organization_id N/A N/A self fake_org pk user super_user N/A N/A N/A self assertEqual N/A resp __class__ HttpResponse N/A test_has_perm_good_case N/A N/A self N/A N/A N/A Test that we actually allow people through. N/A N/A N/A self client user N/A self fake_owner N/A resp N/A N/A N/A self client post _fake_invite_user N/A organization_id N/A N/A self fake_org pk user N/A self fake_owner N/A N/A N/A self assertEqual N/A resp __class__ HttpResponse N/A test_requires_parent_org_owner N/A N/A self N/A N/A N/A Correctly suss out parent org owners. N/A N/A N/A self assertTrue N/A N/A decorators requires_parent_org_owner N/A self owner_org_user N/A N/A N/A self assertFalse N/A N/A decorators requires_parent_org_owner N/A self member_org_user N/A baby_org N/A N/A N/A Organization objects create name baby N/A baby_ou N/A N/A N/A OrganizationUser objects create user N/A self fake_viewer organization baby_org N/A N/A baby_org parent_org N/A self fake_org N/A N/A N/A baby_org save N/A N/A N/A self assertFalse N/A N/A decorators requires_parent_org_owner baby_ou N/A test_can_create_sub_org N/A N/A self N/A N/A N/A Only an owner can create sub orgs. N/A N/A N/A self assertTrue N/A N/A decorators can_create_sub_org N/A self owner_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_create_sub_org N/A self member_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_create_sub_org N/A self viewer_org_user N/A test_can_remove_org N/A N/A self N/A N/A N/A Only an owner can create sub orgs. N/A N/A N/A self assertTrue N/A N/A decorators can_remove_org N/A self owner_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_remove_org N/A self member_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_remove_org N/A self viewer_org_user N/A test_can_invite_member N/A N/A self N/A N/A N/A Only an owner can create sub orgs. N/A N/A N/A self assertTrue N/A N/A decorators can_invite_member N/A self owner_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_invite_member N/A self member_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_invite_member N/A self viewer_org_user N/A test_can_remove_member N/A N/A self N/A N/A N/A Only an owner can create sub orgs. N/A N/A N/A self assertTrue N/A N/A decorators can_remove_member N/A self owner_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_remove_member N/A self member_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_remove_member N/A self viewer_org_user N/A test_can_modify_query_thresh N/A N/A self N/A N/A N/A Only an parent owner can modify query thresholds. N/A N/A N/A self assertTrue N/A N/A decorators can_modify_query_thresh N/A self owner_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_modify_query_thresh N/A self member_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_modify_query_thresh N/A self viewer_org_user N/A test_can_view_sub_org_settings N/A N/A self N/A N/A N/A Only an parent owner can create sub orgs. N/A N/A N/A self assertTrue N/A N/A decorators can_view_sub_org_settings N/A self owner_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_view_sub_org_settings N/A self member_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_view_sub_org_settings N/A self viewer_org_user N/A test_can_view_sub_org_fields N/A N/A self N/A N/A N/A Only an parent owner can create sub orgs. N/A N/A N/A self assertTrue N/A N/A decorators can_view_sub_org_fields N/A self owner_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_view_sub_org_fields N/A self member_org_user N/A N/A N/A self assertFalse N/A N/A decorators can_view_sub_org_fields N/A self viewer_org_user N/A test_requires_owner N/A N/A self N/A N/A N/A Test ownerness. N/A N/A N/A self assertTrue N/A N/A decorators requires_owner N/A self owner_org_user N/A N/A N/A self assertFalse N/A N/A decorators requires_owner N/A self member_org_user N/A N/A N/A self assertFalse N/A N/A decorators requires_owner N/A self viewer_org_user N/A test_requires_owner_w_child_org_and_parent_owner N/A N/A self N/A N/A N/A Parent owners are as child owners. N/A baby_org N/A N/A N/A Organization objects create name baby N/A N/A baby_org parent_org N/A self fake_org N/A N/A N/A baby_org save N/A N/A N/A self assertTrue N/A N/A decorators requires_owner N/A self owner_org_user N/A test_requires_member N/A N/A self N/A N/A N/A Test membership. N/A N/A N/A self assertTrue N/A N/A decorators requires_member N/A self member_org_user N/A N/A N/A self assertTrue N/A N/A decorators requires_member N/A self member_org_user N/A N/A N/A self assertFalse N/A N/A decorators requires_member N/A self viewer_org_user N/A test_requires_viewer N/A N/A self N/A N/A N/A Test viewership. N/A N/A N/A self assertTrue N/A N/A decorators requires_viewer N/A self owner_org_user N/A N/A N/A self assertTrue N/A N/A decorators requires_viewer N/A self member_org_user N/A N/A N/A self assertTrue N/A N/A decorators requires_viewer N/A self viewer_org_user N/A test_requires_superuser N/A N/A self N/A N/A N/A Test superusership. N/A N/A N/A self assertFalse N/A N/A decorators requires_superuser N/A self owner_org_user N/A N/A N/A self assertFalse N/A N/A decorators requires_superuser N/A self member_org_user N/A N/A N/A self assertFalse N/A N/A decorators requires_superuser N/A self viewer_org_user N/A N/A N/A self assertTrue N/A N/A decorators requires_superuser N/A self superuser_org_user N/A N/A