1# Copyright 2015 gRPC authors. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14"""Common code for unit tests of the interoperability test code.""" 15 16from tests.interop import methods 17 18 19class IntraopTestCase(object): 20 """Unit test methods. 21 22 This class must be mixed in with unittest.TestCase and a class that defines 23 setUp and tearDown methods that manage a stub attribute. 24 """ 25 26 def testEmptyUnary(self): 27 methods.TestCase.EMPTY_UNARY.test_interoperability(self.stub, None) 28 29 def testLargeUnary(self): 30 methods.TestCase.LARGE_UNARY.test_interoperability(self.stub, None) 31 32 def testServerStreaming(self): 33 methods.TestCase.SERVER_STREAMING.test_interoperability(self.stub, None) 34 35 def testClientStreaming(self): 36 methods.TestCase.CLIENT_STREAMING.test_interoperability(self.stub, None) 37 38 def testPingPong(self): 39 methods.TestCase.PING_PONG.test_interoperability(self.stub, None) 40 41 def testCancelAfterBegin(self): 42 methods.TestCase.CANCEL_AFTER_BEGIN.test_interoperability( 43 self.stub, None 44 ) 45 46 def testCancelAfterFirstResponse(self): 47 methods.TestCase.CANCEL_AFTER_FIRST_RESPONSE.test_interoperability( 48 self.stub, None 49 ) 50 51 def testTimeoutOnSleepingServer(self): 52 methods.TestCase.TIMEOUT_ON_SLEEPING_SERVER.test_interoperability( 53 self.stub, None 54 ) 55