Exemplo n.º 1
0
 def test_signature_algorithm_valid_non_default_signature_algo(self):
     """Tests License() for valid, non-default signature_algorithm"""
     License(
         to_document(serialize(
             LicenseData('2014-01-01T00:00:00', '2014-01-01T00:00:01'))),
         '<signature>',
         signature_algorithm='HELLOwithWORLD')
Exemplo n.º 2
0
 def test_encoded_valid(self):
     """Tests that License() with valid encoded data has correct encoded
     value"""
     License(
         to_document(serialize(
             LicenseData('2014-01-01T00:00:00', '2014-01-01T00:00:01'))),
         '<signature>')
Exemplo n.º 3
0
def License_signature_encoding0():
    """Tests License() for invalid signature_encoding"""
    with assert_exception(ValueError):
        License(to_document(serialize(
            LicenseData('2014-01-01T00:00:00', '2014-01-01T00:00:01'))),
        '<signature>',
        signature_encoding = 'UTF-8/Base64')
Exemplo n.º 4
0
 def test_signature_algorithm_valid_non_default_signature_algo(self):
     """Tests License() for valid, non-default signature_algorithm"""
     License(to_document(
         serialize(LicenseData('2014-01-01T00:00:00',
                               '2014-01-01T00:00:01'))),
             '<signature>',
             signature_algorithm='HELLOwithWORLD')
Exemplo n.º 5
0
def License_signature_algorithm0():
    """Tests License() for invalid signature_algorithm"""
    with assert_exception(ValueError):
        License(to_document(serialize(
            LicenseData('2014-01-01T00:00:00', '2014-01-01T00:00:01'))),
        '<signature>',
        signature_algorithm = 'invalid')
Exemplo n.º 6
0
    def test_to_document(self):
        """Tests that todocument creates a valid XML document"""
        expected = 'hello world'

        self.assertEqual(
            expected,
            deserialize(fromstring(to_document(serialize(expected)))[0]))
Exemplo n.º 7
0
 def test_encoded_valid(self):
     """Tests that License() with valid encoded data has correct encoded
     value"""
     License(
         to_document(
             serialize(
                 LicenseData('2014-01-01T00:00:00',
                             '2014-01-01T00:00:01'))), '<signature>')
Exemplo n.º 8
0
def License_signature_encoding0():
    """Tests License() for invalid signature_encoding"""
    with assert_exception(ValueError):
        License(to_document(
            serialize(LicenseData('2014-01-01T00:00:00',
                                  '2014-01-01T00:00:01'))),
                '<signature>',
                signature_encoding='UTF-8/Base64')
Exemplo n.º 9
0
def License_signature_algorithm0():
    """Tests License() for invalid signature_algorithm"""
    with assert_exception(ValueError):
        License(to_document(
            serialize(LicenseData('2014-01-01T00:00:00',
                                  '2014-01-01T00:00:01'))),
                '<signature>',
                signature_algorithm='invalid')
Exemplo n.º 10
0
 def test_signature_encoding_invalid(self):
     """Tests License() for invalid signature_encoding"""
     with self.assertRaises(ValueError):
         License(to_document(
             serialize(
                 LicenseData('2014-01-01T00:00:00',
                             '2014-01-01T00:00:01'))),
                 '<signature>',
                 signature_encoding='UTF-8/Base64')
Exemplo n.º 11
0
 def test_signature_algorithm_invalid(self):
     """Tests License() for invalid signature_algorithm"""
     with self.assertRaises(ValueError):
         License(to_document(
             serialize(
                 LicenseData('2014-01-01T00:00:00',
                             '2014-01-01T00:00:01'))),
                 '<signature>',
                 signature_algorithm='invalid')
Exemplo n.º 12
0
 def test_signature_encoding_invalid(self):
     """Tests License() for invalid signature_encoding"""
     with self.assertRaises(ValueError):
         License(
             to_document(serialize(
                 LicenseData(
                     '2014-01-01T00:00:00',
                     '2014-01-01T00:00:01'))),
             '<signature>',
             signature_encoding='UTF-8/Base64')
Exemplo n.º 13
0
 def test_signature_algorithm_invalid(self):
     """Tests License() for invalid signature_algorithm"""
     with self.assertRaises(ValueError):
         License(
             to_document(serialize(
                 LicenseData(
                     '2014-01-01T00:00:00',
                     '2014-01-01T00:00:01'))),
             '<signature>',
             signature_algorithm='invalid')
Exemplo n.º 14
0
def to_document0():
    """Tests that to_document creates a valid XML document"""
    expected = 'hello world'

    assert_eq(
        expected,
        deserialize(
            fromstring(
                to_document(
                    serialize(expected)))
            [0]))
Exemplo n.º 15
0
    def test_to_document(self):
        """Tests that todocument creates a valid XML document"""
        expected = 'hello world'

        self.assertEqual(
            expected,
            deserialize(
                fromstring(
                    to_document(
                        serialize(expected)))
                [0]))