Merge "Remove pool_id attr from creation request body of pool_member"
This commit is contained in:
commit
1417c9a3a3
|
@ -44,3 +44,11 @@ class PoolMember(resource.Resource):
|
|||
#: with a weight of 10 receives five times as much traffic as a member
|
||||
#: with weight of 2.
|
||||
weight = resource.prop('weight', type=int)
|
||||
|
||||
@classmethod
|
||||
def _get_create_body(cls, attrs):
|
||||
# Exclude pool_id from attrs since it is not expected by LBaaS service
|
||||
if 'pool_id' in attrs:
|
||||
attrs.pop('pool_id')
|
||||
|
||||
return {cls.resource_key: attrs}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
|
||||
import testtools
|
||||
|
||||
from openstack.network.v2 import pool_member
|
||||
|
@ -49,3 +51,9 @@ class TestPoolMember(testtools.TestCase):
|
|||
self.assertEqual(EXAMPLE['protocol_port'], sot.protocol_port)
|
||||
self.assertEqual(EXAMPLE['subnet_id'], sot.subnet_id)
|
||||
self.assertEqual(EXAMPLE['weight'], sot.weight)
|
||||
|
||||
def test_create_body(self):
|
||||
params = copy.deepcopy(EXAMPLE)
|
||||
params['pool_id'] = {'POOL1_ID'}
|
||||
body = pool_member.PoolMember._get_create_body(params)
|
||||
self.assertEqual(EXAMPLE, body['member'])
|
||||
|
|
Loading…
Reference in New Issue