def test_update_subnet(self):
        # update subnet successfully
        url = '/subnets/1'
        data = {
            'subnet': '192.168.100.0/24',
            'name': 'update_subnet'
        }
        return_value = self.put(url, data)
        resp = json.loads(return_value.get_data())
        self.assertEqual(return_value.status_code, 200)
        self.assertTrue(item in data.items() for item in resp.items())

        # give a non-existed id
        url = '/subnets/99'
        data = {
            'subnet': '192.168.100.0/24',
            'name': 'subnet_invalid'
        }
        return_value = self.put(url, data)
        self.assertEqual(return_value.status_code, 404)

        # update with wrong filter
        url = '/subnets/1'
        data = {
            'xxx': 'wrong_filter'
        }
        return_value = self.put(url, data)
        self.assertEqual(return_value.status_code, 400)
dataset/ETHPy150Open openstack/compass-core/compass/tests/api/test_api.py/TestSubnetAPI.test_update_subnet/original