Convert floating IP pool tests to httpretty
Change-Id: Ic9332ddd30a0bc3ffc5ed7c046f60ded3f940e85 blueprint: httpretty-testing
This commit is contained in:
parent
37f02bde12
commit
98ef56332d
@ -196,3 +196,21 @@ class BulkFixture(base.Fixture):
|
||||
httpretty.register_uri(httpretty.POST, self.url(),
|
||||
body=post_os_floating_ips_bulk,
|
||||
content_type='application/json')
|
||||
|
||||
|
||||
class PoolsFixture(base.Fixture):
|
||||
|
||||
base_url = 'os-floating-ip-pools'
|
||||
|
||||
def setUp(self):
|
||||
super(PoolsFixture, self).setUp()
|
||||
|
||||
get_os_floating_ip_pools = {
|
||||
'floating_ip_pools': [
|
||||
{'name': 'foo'},
|
||||
{'name': 'bar'}
|
||||
]
|
||||
}
|
||||
httpretty.register_uri(httpretty.GET, self.url(),
|
||||
body=jsonutils.dumps(get_os_floating_ip_pools),
|
||||
content_type='application/json')
|
||||
|
@ -14,18 +14,19 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from novaclient.tests.fixture_data import client
|
||||
from novaclient.tests.fixture_data import floatingips as data
|
||||
from novaclient.tests import utils
|
||||
from novaclient.tests.v1_1 import fakes
|
||||
from novaclient.v1_1 import floating_ip_pools
|
||||
|
||||
|
||||
cs = fakes.FakeClient()
|
||||
class TestFloatingIPPools(utils.FixturedTestCase):
|
||||
|
||||
|
||||
class TestFloatingIPPools(utils.TestCase):
|
||||
client_fixture_class = client.V1
|
||||
data_fixture_class = data.PoolsFixture
|
||||
|
||||
def test_list_floating_ips(self):
|
||||
fl = cs.floating_ip_pools.list()
|
||||
cs.assert_called('GET', '/os-floating-ip-pools')
|
||||
fl = self.cs.floating_ip_pools.list()
|
||||
self.assert_called('GET', '/os-floating-ip-pools')
|
||||
[self.assertIsInstance(f, floating_ip_pools.FloatingIPPool)
|
||||
for f in fl]
|
||||
|
Loading…
Reference in New Issue
Block a user