def test_error(self): path = '/tmp/ops-chown-error' self.assertFalse(ops._chown(path, uid=-2)) self.assertFalse(ops._chown(path, gid=-2)) self.assertFalse(ops.chown(path, user=lambda x: x)) self.assertFalse(ops.chown(path, user='******')) self.assertFalse(ops.chown(path, user=ops.user('ops-chown'))) self.assertFalse(ops.chown(path, group=lambda x: x)) self.assertFalse(ops.chown(path, group='ops-chown')) self.assertFalse(ops.chown(path, group=ops.user('ops-chown')))
def test_get_by_invalid_name(self): user = ops.user(name=helper.uuid()) self.assertTrue(user.id is None) self.assertTrue(user.name is None) self.assertFalse(user)
def test_get_by_name(self): user = ops.user(name=self.name) self.assertEqual(user.id, self.id) self.assertTrue(user)
def test_get_by_invalid_id(self): user = ops.user(id=-1) self.assertTrue(user.id is None) self.assertTrue(user.name is None) self.assertFalse(user)
def test_get_by_id(self): user = ops.user(id=self.id) self.assertEqual(user.name, self.name) self.assertTrue(user)
def test_default(self): user = ops.user(self.name) self.assertEqual(user.id, self.id) self.assertTrue(user)