コード例 #1
0
    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)
コード例 #2
0
    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)