예제 #1
0
 def test_create_close_message_parsable(self):
     from xml.parsers.expat import ExpatError
     msg, _ = upnp._create_close_message('127.0.0.1', 8888)
     try:
         upnp.parseString(msg)
     except ExpatError as e:
         pytest.fail('Incorrect XML message: {}'.format(e))
예제 #2
0
 def test_create_close_message_parsable(self):
     from xml.parsers.expat import ExpatError
     msg, _ = upnp._create_close_message('127.0.0.1', 8888)
     try:
         upnp.parseString(msg)
     except ExpatError as e:
         pytest.fail('Incorrect XML message: {}'.format(e))
예제 #3
0
 def test_create_close_message_contains_right_stuff(self):
     settings = {'protocol': 'test proto', 'upnp_schema': 'test schema'}
     msg, fn_name = upnp._create_close_message('127.0.0.1', 8888,
                                               **settings)
     assert fn_name == 'DeletePortMapping'
     assert '8888' in msg
     assert settings['protocol'] in msg
     assert settings['upnp_schema'] in msg
예제 #4
0
 def test_create_close_message_contains_right_stuff(self):
     settings = {'protocol': 'test proto',
                 'upnp_schema': 'test schema'}
     msg, fn_name = upnp._create_close_message('127.0.0.1', 8888, **
                                               settings)
     assert fn_name == 'DeletePortMapping'
     assert '8888' in msg
     assert settings['protocol'] in msg
     assert settings['upnp_schema'] in msg