Merge "Convert floating IP pool tests to httpretty"

This commit is contained in:
Jenkins 2014-06-26 02:07:47 +00:00 committed by Gerrit Code Review
commit 7d1cd188e0
2 changed files with 25 additions and 6 deletions
novaclient/tests

@ -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]