Beispiel #1
0
    def test_restful_expand_attribute(self, mock_send_request):
        model = Restful()
        self.assertRaises(dockercloud.ApiError, model._expand_attribute, "attribute")

        model._detail_uri = "fake/uuid"
        mock_send_request.side_effect = [{"key": "value"}, None]
        self.assertEqual("value", model._expand_attribute("key"))

        self.assertIsNone(model._expand_attribute("key"))
    def test_restful_expand_attribute(self, mock_send_request):
        model = Restful()
        self.assertRaises(dockercloud.ApiError, model._expand_attribute,
                          'attribute')

        model._resource_uri = 'fake/uuid'
        mock_send_request.side_effect = [{'key': 'value'}, None]
        self.assertEqual('value', model._expand_attribute('key'))

        self.assertIsNone(model._expand_attribute('key'))