Did I find the right examples for you? yes no

All Samples(7)  |  Call(6)  |  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_user_access(self):
        access = user_has_access(self.host, self.user_a)
        self.assertEqual(access, True)
 
        access = user_has_access(self.host, self.user_b)
        self.assertEqual(access, False)
 
    def test_grant_access(self):
        access = user_has_access(self.host, self.user_b)
 
        grant_access(self.host, self.user_b)
        access = user_has_access(self.host, self.user_b)
        self.assertEqual(access, True)