コード例 #1
0
 def test_forward_all_but_name(self):
     path = self._create_file()
     try:
         with exception_expected(AttributeError):
             with open(path) as f:
                 fwd = ForwardToFile(f, 'name', 'foo')
                 fwd.name
     finally:
         unlink_quietly(path)
コード例 #2
0
ファイル: TestProxy.py プロジェクト: AppScale/appscale
 def test_forward_all_but_name(self):
     path = self._create_file()
     try:
         with exception_expected(AttributeError):
             with open(path) as f:
                 fwd = ForwardToFile(f, 'name', 'foo')
                 fwd.name
     finally:
         unlink_quietly(path)
コード例 #3
0
 def test_forward_all_but_name_mode(self):
     path = self._create_file()
     try:
         with open(path) as f:
             fwd = ForwardToFile(f, 'name', 'mode')
             fwd.closed  # should not fail
             with exception_expected(AttributeError):
                 fwd.name
             with exception_expected(AttributeError):
                 fwd.mode
     finally:
         unlink_quietly(path)
コード例 #4
0
ファイル: TestProxy.py プロジェクト: AppScale/appscale
 def test_forward_all_but_name_mode(self):
     path = self._create_file()
     try:
         with open(path) as f:
             fwd = ForwardToFile(f, 'name', 'mode')
             fwd.closed # should not fail
             with exception_expected(AttributeError):
                 fwd.name
             with exception_expected(AttributeError):
                 fwd.mode
     finally:
         unlink_quietly(path)
コード例 #5
0
    def test_forward_all(self):
        path = self._create_file()
        try:
            with open(path) as f:
                contents = ''.join(f.readlines())

            with open(path) as f:
                fwd = ForwardToFile(f)
                contents2 = ''.join(fwd.readlines())

            assert contents2 == contents

        finally:
            unlink_quietly(path)
コード例 #6
0
ファイル: TestProxy.py プロジェクト: AppScale/appscale
    def test_forward_all(self):
        path = self._create_file()
        try:
            with open(path) as f:
                contents = ''.join(f.readlines())

            with open(path) as f:
                fwd = ForwardToFile(f)
                contents2 = ''.join(fwd.readlines())

            assert contents2 == contents

        finally:
            unlink_quietly(path)