a1d52dc22d
There are several common fixtures that every test case wants. Following the pattern in Nova, add a common base test case class to hold these things. Change-Id: I2d2cd91e5051d9cbf230e6f48985d6eddcb7b58a
29 lines
973 B
Python
29 lines
973 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
|
|
|
|
# Local
|
|
import quantum.plugins.nicira.nicira_nvp_plugin.api_client.common as naco
|
|
from quantum.tests import base
|
|
|
|
|
|
class NvpApiCommonTest(base.BaseTestCase):
|
|
|
|
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'))
|