Esempio n. 1
0
    def test_response_decoder(self):
        data = dict(field='value')
        encoded = encode_data(data)
        signature = generate_signature(self.private_key, encoded)

        decoded = decode_response_data(self.private_key, encoded, signature)
        self.assertEqual(data, decoded)
        self.assertRaises(SignatureMismatch, decode_response_data, self.private_key, encoded, 'privateKey2')
Esempio n. 2
0
    def test_response_decoder(self):
        data = dict(field='value')
        encoded = encode_data(data)
        signature = generate_signature(self.private_key, encoded)

        decoded = decode_response_data(self.private_key, encoded, signature)
        self.assertEqual(data, decoded)
        self.assertRaises(SignatureMismatch, decode_response_data,
                          self.private_key, encoded, 'privateKey2')
Esempio n. 3
0
    def test_signature_generation(self):
        expected = 'cJxZYijbaA+bXqIJIPSV1G0v8DI='

        data = dict(field='value')
        signature = generate_signature(self.private_key, data)
        self.assertEqual(expected, signature)

        data = encode_data(data)
        signature = generate_signature(self.private_key, data)
        self.assertEqual(expected, signature)
Esempio n. 4
0
    def test_signature_generation(self):
        expected = 'cJxZYijbaA+bXqIJIPSV1G0v8DI='

        data = dict(field='value')
        signature = generate_signature(self.private_key, data)
        self.assertEqual(expected, signature)

        data = encode_data(data)
        signature = generate_signature(self.private_key, data)
        self.assertEqual(expected, signature)
Esempio n. 5
0
 def test_data_encoding(self):
     expected = 'eyJmaWVsZCI6ICJ2YWx1ZSJ9'
     data = dict(field='value')
     encoded = encode_data(data)
     self.assertEqual(expected, encoded)
Esempio n. 6
0
 def test_data_encoding(self):
     expected = 'eyJmaWVsZCI6ICJ2YWx1ZSJ9'
     data = dict(field='value')
     encoded = encode_data(data)
     self.assertEqual(expected, encoded)