Exemple #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')
Exemple #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>')
Exemple #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')
Exemple #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')
Exemple #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')
Exemple #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]))
Exemple #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>')
Exemple #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')
Exemple #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')
Exemple #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')
Exemple #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')
Exemple #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')
Exemple #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')
Exemple #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]))
Exemple #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]))