~tribaal/txaws/xss-hardening

« back to all changes in this revision

Viewing changes to txaws/tests/test_util.py

  • Committer: Tristan Seligmann
  • Date: 2009-04-27 23:53:32 UTC
  • mfrom: (3.1.5 client)
  • Revision ID: mithrandi@mithrandi.net-20090427235332-l8azkl1kvn5pjtay
mergeĀ lp:~lifeless/txaws/client

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from twisted.trial.unittest import TestCase
 
2
 
 
3
from txaws.util import *
 
4
 
 
5
class MiscellaneousTests(TestCase):
 
6
 
 
7
    def test_hmac_sha1(self):
 
8
        cases = [
 
9
            ('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b'.decode('hex'),
 
10
             'Hi There', 'thcxhlUFcmTii8C2+zeMjvFGvgA='),
 
11
            ('Jefe', 'what do ya want for nothing?',
 
12
             '7/zfauXrL6LSdBbV8YTfnCWafHk='),
 
13
            ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'.decode('hex'),
 
14
             '\xdd' * 50, 'El1zQrmsEc2Ro5r0iqF7T2PxddM='),
 
15
            ]
 
16
 
 
17
        for key, data, expected in cases:
 
18
            self.assertEqual(hmac_sha1(key, data), expected)
 
19
 
 
20
    def test_iso8601time(self):
 
21
        self.assertEqual("2006-07-07T15:04:56Z", iso8601time((2006,7,7,15,4,56,
 
22
            0, 0, 0)))