Merge "Fix _show_resource in Designate::Record"
This commit is contained in:
commit
2fc8db97d1
@ -87,6 +87,11 @@ class DesignateClientPlugin(client_plugin.ClientPlugin):
|
||||
return self.client().records.delete(domain_id,
|
||||
kwargs.pop('id'))
|
||||
|
||||
def record_show(self, **kwargs):
|
||||
domain_id = self.get_domain_id(kwargs.pop('domain'))
|
||||
return self.client().records.get(domain_id,
|
||||
kwargs.pop('id'))
|
||||
|
||||
|
||||
class DesignateDomainConstraint(constraints.BaseCustomConstraint):
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from heat.common.i18n import _
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
@ -156,7 +158,9 @@ class DesignateRecord(resource.Resource):
|
||||
# FIXME(kanagaraj-manickam) Remove this method once designate defect
|
||||
# 1485552 is fixed.
|
||||
def _show_resource(self):
|
||||
return dict(self.client().records.get(self.resource_id).items())
|
||||
kwargs = dict(domain=self.properties[self.DOMAIN],
|
||||
id=self.resource_id)
|
||||
return dict(six.iteritems(self.client_plugin().record_show(**kwargs)))
|
||||
|
||||
|
||||
def resource_mapping():
|
||||
|
@ -302,3 +302,20 @@ class DesignateClientPluginRecordTest(common.HeatTestCase):
|
||||
self._client.records.delete.assert_called_once_with(
|
||||
self.sample_domain_id,
|
||||
self.sample_uuid)
|
||||
|
||||
@mock.patch.object(client.DesignateClientPlugin, 'client')
|
||||
@mock.patch('designateclient.v1.records.Record')
|
||||
def test_record_show(self, mock_record, client_designate):
|
||||
self._client.records.get.return_value = None
|
||||
client_designate.return_value = self._client
|
||||
|
||||
record = dict(
|
||||
id=self.sample_uuid,
|
||||
domain=self.sample_domain_id
|
||||
)
|
||||
|
||||
self.client_plugin.record_show(**record)
|
||||
|
||||
self._client.records.get.assert_called_once_with(
|
||||
self.sample_domain_id,
|
||||
self.sample_uuid)
|
||||
|
@ -242,7 +242,7 @@ class DesignateRecordTest(common.HeatTestCase):
|
||||
data='1.1.1.1'
|
||||
)
|
||||
rsc = records.Record(args)
|
||||
mock_notification_get = self.test_client.records.get
|
||||
mock_notification_get = self.test_client_plugin.record_show
|
||||
mock_notification_get.return_value = rsc
|
||||
|
||||
self.assertEqual(args,
|
||||
|
Loading…
x
Reference in New Issue
Block a user