def stat(path): """stat() a path.""" request = untrusted_runner_pb2.StatRequest(path=path) response = host.stub().Stat(request) if not response.result: return None return response
def test_stat(self): """Test file_impl.stat.""" self.fs.CreateFile('/file') request = untrusted_runner_pb2.StatRequest(path='/file') response = file_impl.stat(request, None) expected = os.stat('/file') self.assertTrue(response.result) self.assertEqual(expected.st_mode, response.st_mode) self.assertEqual(expected.st_size, response.st_size) self.assertEqual(expected.st_atime, response.st_atime) self.assertEqual(expected.st_ctime, response.st_ctime) self.assertEqual(expected.st_mtime, response.st_mtime)
def test_stat_does_not_exist(self): """Test file_impl.stat (does not exist).""" request = untrusted_runner_pb2.StatRequest(path='/file') response = file_impl.stat(request, None) self.assertFalse(response.result)