vmware-nsx/quantum/tests/unit/nicira/test_nvp_api_common.py
Monty Taylor c90977b4f6 Use testtools instead of unittest or unittest2.
As part of the move towards testr and parallel test running, we
start to use testtools and fixtures to make the test suite
resilient and more pedantic.

Part of blueprint grizzly-testtools

Change-Id: I90250de9fe21237db34f6a50b89b15863e270aa5
2013-02-26 19:32:30 +09:00

31 lines
975 B
Python

# Copyright (C) 2009-2011 Nicira Networks, Inc. All Rights Reserved.
#
# This software is provided only under the terms and conditions of a written
# license agreement with Nicira. If no such agreement applies to you, you are
# not authorized to use this software. Contact Nicira to obtain an appropriate
# license: www.nicira.com.
# System
import httplib
# Third party
import testtools
# Local
import quantum.plugins.nicira.nicira_nvp_plugin.api_client.common as naco
class NvpApiCommonTest(testtools.TestCase):
def test_conn_str(self):
conn = httplib.HTTPSConnection('localhost', 4242, timeout=0)
self.assertTrue(
naco._conn_str(conn) == 'https://localhost:4242')
conn = httplib.HTTPConnection('localhost', 4242, timeout=0)
self.assertTrue(
naco._conn_str(conn) == 'http://localhost:4242')
self.assertRaises(TypeError, naco._conn_str,
('not an httplib.HTTPSConnection'))