Did I find the right examples for you? yes no

All Samples(9)  |  Call(8)  |  Derive(0)  |  Import(1)

src/n/e/network-admin-HEAD/netadmin/permissions/tests.py   network-admin(Download)
 
from netadmin.networks.models import Host
from utils import user_has_access, grant_access, revoke_access, \
    user_can_edit, grant_edit, revoke_edit
 
    def test_can_edit(self):
        edit = user_can_edit(self.host, self.user_a)
        self.assertEqual(edit, True)
 
        revoke_access(self.host, self.user_b)
        edit = user_can_edit(self.host, self.user_b)
        self.assertEqual(edit, False)
 
        grant_access(self.host, self.user_b)
        edit = user_can_edit(self.host, self.user_b)
    def test_revoke_edit(self):
        grant_access(self.host, self.user_b)
        edit = user_can_edit(self.host, self.user_b)
        self.assertEqual(edit, True)