Skip to content

Commit

Permalink
release v2.13.29
Browse files Browse the repository at this point in the history
  • Loading branch information
Orisdaddy committed Nov 23, 2020
1 parent 5977095 commit 9977a81
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
3 changes: 3 additions & 0 deletions aliyun-python-sdk-core/ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2020-11-23 Version 2.13.29
1, Fix the bug that token is not refreshed for a long time.

2020-11-12 Version 2.13.28
1, Fix ROA signature error caused by URL not carrying regionId.

Expand Down
2 changes: 1 addition & 1 deletion aliyun-python-sdk-core/aliyunsdkcore/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.13.28"
__version__ = "2.13.29"


import logging
Expand Down
21 changes: 17 additions & 4 deletions aliyun-python-sdk-core/tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# coding=utf-8
import sys

from tests import unittest, MyServer

Expand Down Expand Up @@ -93,8 +94,14 @@ def test_json_content_type(self):
request.set_content_type('application/json')
request.add_body_params('key', 'value')
response = self.do_request(client, request)
headers = dict(response.headers._headers)
self.assertEqual('application/json', headers['Content-Type'])
if sys.version_info.major == 2:
headers = {
item.split(':')[0]: item.split(':')[1]
for item in response.headers.headers
}
else:
headers = dict(response.headers._headers)
self.assertEqual('application/json', headers['Content-Type'].strip('\r\n '))

def test_xml_content_type(self):
client = AcsClient("id", "aks", region_id='cn-hangzhou', port=51352)
Expand All @@ -108,5 +115,11 @@ def test_xml_content_type(self):
request.add_body_params('key', 'value')
request.set_content_type('application/xml')
response = self.do_request(client, request)
headers = dict(response.headers._headers)
self.assertEqual('application/xml', headers['Content-Type'])
if sys.version_info.major == 2:
headers = {
item.split(':')[0]: item.split(':')[1]
for item in response.headers.headers
}
else:
headers = dict(response.headers._headers)
self.assertEqual('application/xml', headers['Content-Type'].strip('\r\n '))
7 changes: 7 additions & 0 deletions aliyun-python-sdk-core/tests/test_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ def test_roa_request_get_url(self):
url = r.get_url("regionid", "accesskeyid", "secret")
self.assertEqual(url, "/users/jacksontian?RegionId=regionid")

r = RoaRequest("product", "version", "action_name")
r.set_uri_pattern('/users/[user]')
r.set_path_params({'user': 'jacksontian'})
r.add_query_param('RegionId', 'cn-hangzhou')
url = r.get_url("regionid", "accesskeyid", "secret")
self.assertEqual(url, "/users/jacksontian?RegionId=cn-hangzhou")

@patch("aliyunsdkcore.utils.parameter_helper.get_rfc_2616_date")
def test_get_signed_header(self, mock_get_rfc_2616_date):
r = RoaRequest("product", "version", "action_name", headers={})
Expand Down

0 comments on commit 9977a81

Please sign in to comment.