Esempio n. 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'))])
Esempio n. 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'))])
Esempio n. 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'))])
Esempio n. 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'))])
Esempio n. 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, "")
Esempio n. 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, "")
Esempio n. 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, "")
Esempio n. 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, "")