File: test_signature_service.py

package info (click to toggle)
python-braintree 3.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,376 kB
  • ctags: 1,998
  • sloc: python: 13,634; makefile: 73; sh: 8
file content (14 lines) | stat: -rw-r--r-- 454 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from tests.test_helper import *

class FakeDigest(object):

    @staticmethod
    def hmac_hash(key, data):
        return "%s_signed_with_%s" % (data, key)

class TestSignatureService(unittest.TestCase):

    def test_hashes_with_digest(self):
        signature_service = SignatureService("fake_key", FakeDigest.hmac_hash)
        signed = signature_service.sign({"foo": "bar"})
        self.assertEquals("foo=bar_signed_with_fake_key|foo=bar", signed)