示例#1
0
文件: code_test.py 项目: Eveler/dmsic
 def test_create_method_list_param(self):
     xml = utils.open_document('tests/assets/generation/list_param.xsd')
     code = xsd2py.generate_code_from_xsd(xml)
     if six.PY3:
         code = code.decode()
     assert_contains('def create(cls, Items):', code)
     assert_contains('instance.Items = Items', code)
     assert_not_contains('Itemss', code)
示例#2
0
 def test_create_method_list_param(self):
     xml = utils.open_document('tests/assets/generation/list_param.xsd')
     code = xsd2py.generate_code_from_xsd(xml)
     if six.PY3:
         code = code.decode()
     assert_contains('def create(cls, Items):', code)
     assert_contains('instance.Items = Items', code)
     assert_not_contains('Itemss', code)
示例#3
0
 def test_evaluate_service_location(self):
     handler, _ = echo_handler()
     service = echo_service(handler)
     service.location = '{scheme}://{host}/ws'
     dispatcher = SOAPDispatcher(service)
     request = SOAPRequest(dict(REQUEST_METHOD='GET', QUERY_STRING='wsdl',
                                HTTP_HOST='soap.example'), '')
     response = dispatcher.dispatch(request)
     self.assert_is_successful_response(response)
     assert_not_contains('{scheme}', response.http_content.decode())
     assert_not_contains('{http}', response.http_content.decode())
示例#4
0
 def test_evaluate_service_location(self):
     handler, _ = echo_handler()
     service = echo_service(handler)
     service.location = '{scheme}://{host}/ws'
     dispatcher = SOAPDispatcher(service)
     request = SOAPRequest(
         dict(REQUEST_METHOD='GET',
              QUERY_STRING='wsdl',
              HTTP_HOST='soap.example'), '')
     response = dispatcher.dispatch(request)
     self.assert_is_successful_response(response)
     assert_not_contains('{scheme}', response.http_content.decode())
     assert_not_contains('{http}', response.http_content.decode())
 def assert_fail(self, value, actual_iterable, message=None):
     return assert_raises(AssertionError, lambda: assert_not_contains(value, actual_iterable, message=message))
 def test_passes_if_iterable_does_not_contain_value(self):
     assert_not_contains(None, ['foo', True])
     assert_not_contains('bar', ('foo', True))
示例#7
0
 def assert_fail(self, value, actual_iterable, message=None):
     return assert_raises(
         AssertionError, lambda: assert_not_contains(
             value, actual_iterable, message=message))
示例#8
0
 def test_passes_if_iterable_does_not_contain_value(self):
     assert_not_contains(None, ['foo', True])
     assert_not_contains('bar', ('foo', True))