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