示例#1
0
 def test_unicode_content_type_and_body_returns_sha1_of_both(
         self, mock_sha1):
     content_type = u"\u4f60\u597d\u4e16\u754c"
     body = u"\u6234\u592b\u5728\u8fd9\u91cc"
     ext = mac.generate_ext(content_type, body)
     eq_(ext, mock_sha1.return_value.hexdigest.return_value)
     eq_(mock_sha1.call_args_list,
         [call((content_type + body).encode('utf-8'))])
示例#2
0
 def test_content_type_and_body_non_none_returns_sha1_of_both(
         self, mock_sha1):
     content_type = "hello world!"
     body = "dave was here"
     ext = mac.generate_ext(content_type, body)
     eq_(ext, mock_sha1.return_value.hexdigest.return_value)
     eq_(mock_sha1.call_args_list,
         [call((content_type + body).encode('utf-8'))])
示例#3
0
 def test_unicode_content_type_and_body_returns_sha1_of_both(self, mock_sha1):
     content_type = u"\u4f60\u597d\u4e16\u754c"
     body = u"\u6234\u592b\u5728\u8fd9\u91cc"
     ext = mac.generate_ext(content_type, body)
     eq_(ext, mock_sha1.return_value.hexdigest.return_value)
     eq_(mock_sha1.call_args_list, [call((content_type + body).encode('utf-8'))])
示例#4
0
 def test_content_type_and_body_non_none_returns_sha1_of_both(self, mock_sha1):
     content_type = "hello world!"
     body = "dave was here"
     ext = mac.generate_ext(content_type, body)
     eq_(ext, mock_sha1.return_value.hexdigest.return_value)
     eq_(mock_sha1.call_args_list, [call((content_type + body).encode('utf-8'))])
示例#5
0
 def test_content_type_none_and_body_non_none_is_zero_length_ext(self):
     content_type = None
     body = "dave was here"
     ext = mac.generate_ext(content_type, body)
     assert_is_not_none(ext)
     eq_(ext, "")
示例#6
0
 def test_content_type_and_body_zero_length_is_zero_length_ext(self):
     content_type = ''
     body = ''
     ext = mac.generate_ext(content_type, body)
     assert_is_not_none(ext)
     eq_(ext, "")
示例#7
0
 def test_content_type_none_and_body_non_none_is_zero_length_ext(self):
     content_type = None
     body = "dave was here"
     ext = mac.generate_ext(content_type, body)
     assert_is_not_none(ext)
     eq_(ext, "")
示例#8
0
 def test_content_type_and_body_zero_length_is_zero_length_ext(self):
     content_type = ''
     body = ''
     ext = mac.generate_ext(content_type, body)
     assert_is_not_none(ext)
     eq_(ext, "")