def test_GivePrivileges(self): core.set_privileges(self.conn, 'P105', 'S101', 'odczyt') self.cur.execute("SELECT Uprawnienia FROM uprawnienia WHERE Sprawa='S101' AND Policjant='P105'") self.assertEqual(self.cur.rowcount, 1) (privileges,) = self.cur.fetchone() self.assertEqual(privileges, 'odczyt')
def test_NoSuchUser(self): with self.assertRaises(core.NoSuchUserError): core.set_privileges(self.conn, 'P106', 'S100', 'odczyt/zapis')
def test_TakeAwayPrivileges(self): core.set_privileges(self.conn, 'P102', 'S100', None) self.cur.execute("SELECT NULL FROM uprawnienia WHERE Sprawa='S100' AND Policjant='P102'") self.assertEqual(self.cur.rowcount, 0)
def test_NoSuchCase(self): with self.assertRaises(core.NoSuchCaseError): core.set_privileges(self.conn, 'P100', 'S105', 'odczyt')