test_apirequest.py (ec2-api-14.0.1) | : | test_apirequest.py (ec2-api-15.0.0) | ||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
# distributed under the License is distributed on an "AS IS" BASIS, | # distributed under the License is distributed on an "AS IS" BASIS, | |||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | |||
# limitations under the License. | # limitations under the License. | |||
from lxml import etree | from lxml import etree | |||
from unittest import mock | from unittest import mock | |||
from oslo_context import context | from oslo_context import context | |||
from oslo_utils import timeutils | from oslo_utils import timeutils | |||
import six | ||||
from ec2api.api import apirequest | from ec2api.api import apirequest | |||
from ec2api.tests.unit import base | from ec2api.tests.unit import base | |||
from ec2api.tests.unit import fakes_request_response as fakes | from ec2api.tests.unit import fakes_request_response as fakes | |||
from ec2api.tests.unit import matchers | from ec2api.tests.unit import matchers | |||
from ec2api.tests.unit import tools | from ec2api.tests.unit import tools | |||
class EC2RequesterTestCase(base.BaseTestCase): | class EC2RequesterTestCase(base.BaseTestCase): | |||
def setUp(self): | def setUp(self): | |||
skipping to change at line 102 | skipping to change at line 101 | |||
} | } | |||
data = req._render_response(resp, 'uuid').decode() | data = req._render_response(resp, 'uuid').decode() | |||
self.assertIn('<FakeActionResponse xmlns="http://ec2.amazonaws.com/' | self.assertIn('<FakeActionResponse xmlns="http://ec2.amazonaws.com/' | |||
'doc/FakeVersion/', data) | 'doc/FakeVersion/', data) | |||
self.assertIn('<int>1</int>', data) | self.assertIn('<int>1</int>', data) | |||
self.assertIn('<string>foo</string>', data) | self.assertIn('<string>foo</string>', data) | |||
def test_render_response_utf8(self): | def test_render_response_utf8(self): | |||
req = apirequest.APIRequest("FakeAction", "FakeVersion", {}) | req = apirequest.APIRequest("FakeAction", "FakeVersion", {}) | |||
resp = { | resp = { | |||
'utf8': six.unichr(40960) + u'abcd' + six.unichr(1972) | 'utf8': chr(40960) + u'abcd' + chr(1972) | |||
} | } | |||
data = req._render_response(resp, 'uuid').decode() | data = req._render_response(resp, 'uuid').decode() | |||
self.assertIn('<utf8>ꀀabcd޴</utf8>', data) | self.assertIn('<utf8>ꀀabcd޴</utf8>', data) | |||
# Tests for individual data element format functions | # Tests for individual data element format functions | |||
def test_return_valid_isoformat(self): | def test_return_valid_isoformat(self): | |||
"""Ensure that the ec2 api returns datetime in xs:dateTime | """Ensure that the ec2 api returns datetime in xs:dateTime | |||
(which apparently isn't datetime.isoformat()) | (which apparently isn't datetime.isoformat()) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added |