コード例 #1
0
 def test_decode_build_is_idempotent(self):
     u1 = urn.encode('component',
                     owner__name='org%',
                     name='name%',
                     version='version%')
     m, f = urn.decode(u1)
     u3 = urn.encode(m, **f)
     self.assertEqual(u1, u3)
コード例 #2
0
 def test_decode_raise_exception_if_missing_object_type(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje::dsds')
コード例 #3
0
 def test_decode_raise_exception_if_too_long3(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje:license:key:junk')
コード例 #4
0
 def test_decode_raise_exception_if_too_long1(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje:component:o:n:v:junk')
コード例 #5
0
 def test_decode_raise_exception_if_too_short_license(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje:license')
コード例 #6
0
 def test_decode_raise_exception_if_incorrect_prefix(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('arn:dje:a:a')
コード例 #7
0
 def test_decode_org(self):
     u = 'urn:dje:owner:name'
     parsed = ('owner', {'name': 'name'})
     self.assertEqual(parsed, urn.decode(u))
コード例 #8
0
 def test_decode_component(self):
     u = 'urn:dje:component:name:version'
     parsed = ('component', {'name': 'name', 'version': 'version'})
     self.assertEqual(parsed, urn.decode(u))
コード例 #9
0
 def test_decode_raise_exception_if_incorrect_prefix(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('arn:dje:a:a')
コード例 #10
0
 def test_decode_build_is_idempotent(self):
     u1 = urn.encode('component', owner__name='org%', name='name%',
                    version='version%')
     m, f = urn.decode(u1)
     u3 = urn.encode(m, **f)
     self.assertEqual(u1, u3)
コード例 #11
0
 def test_decode_org(self):
     u = 'urn:dje:owner:name'
     parsed = ('owner', {'name': 'name'})
     self.assertEqual(parsed, urn.decode(u))
コード例 #12
0
 def test_decode_license(self):
     u = 'urn:dje:license:lic'
     parsed = ('license', {'key': 'lic'})
     assert parsed == urn.decode(u)
コード例 #13
0
 def test_decode_component(self):
     u = 'urn:dje:component:name:version'
     parsed = ('component', {'name': 'name', 'version': 'version'})
     assert parsed == urn.decode(u)
コード例 #14
0
 def test_decode_org(self):
     u = 'urn:dje:owner:name'
     parsed = ('owner', {'name': 'name'})
     assert parsed == urn.decode(u)
コード例 #15
0
ファイル: test_urn.py プロジェクト: yudhik11/scancode-toolkit
 def test_decode_license(self):
     u = 'urn:dje:license:lic'
     parsed = ('license', {'key': 'lic'})
     assert parsed == urn.decode(u)
コード例 #16
0
 def test_decode_component(self):
     u = 'urn:dje:component:name:version'
     parsed = ('component', {'name': 'name', 'version': 'version'})
     self.assertEqual(parsed, urn.decode(u))
コード例 #17
0
ファイル: test_urn.py プロジェクト: yudhik11/scancode-toolkit
 def test_decode_component(self):
     u = 'urn:dje:component:name:version'
     parsed = ('component', {'name': 'name', 'version': 'version'})
     assert parsed == urn.decode(u)
コード例 #18
0
 def test_decode_raise_exception_if_incorrect_prefix_or_ns(self):
     with self.assertRaises(urn.URNValidationError):
             urn.decode('x:x:x:x')
コード例 #19
0
 def test_decode_license(self):
     u = 'urn:dje:license:lic'
     parsed = ('license', {'key': 'lic'})
     self.assertEqual(parsed, urn.decode(u))
コード例 #20
0
 def test_decode_raise_exception_if_too_short_license(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje:license')
コード例 #21
0
 def test_decode_raise_exception_if_too_short_component(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje:component')
コード例 #22
0
 def test_decode_raise_exception_if_too_long1(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje:component:o:n:v:junk')
コード例 #23
0
 def test_decode_raise_exception_if_incorrect_prefix_or_ns(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('x:x:x:x')
コード例 #24
0
 def test_decode_raise_exception_if_too_long2(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje:owner:org:junk')
コード例 #25
0
 def test_decode_raise_exception_if_too_short_component(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje:component')
コード例 #26
0
 def test_decode_raise_exception_if_too_long3(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje:license:key:junk')
コード例 #27
0
 def test_decode_raise_exception_if_too_long2(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje:owner:org:junk')
コード例 #28
0
 def test_decode_raise_exception_if_unknown_object_type(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje:marshmallows:dsds')
コード例 #29
0
 def test_decode_raise_exception_if_unknown_object_type(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje:marshmallows:dsds')
コード例 #30
0
 def test_decode_raise_exception_if_missing_object_type(self):
     with self.assertRaises(urn.URNValidationError):
         urn.decode('urn:dje::dsds')
コード例 #31
0
 def test_encode_decode_is_idempotent(self):
     object_type = 'component'
     fields = {'name': 'SIP Servlets (MSS)', 'version': 'v 1.4.0.FINAL'}
     encoded = 'urn:dje:component:SIP+Servlets+%28MSS%29:v+1.4.0.FINAL'
     assert encoded == urn.encode(object_type, **fields)
     assert object_type, fields == urn.decode(encoded)
コード例 #32
0
 def test_encode_decode_is_idempotent(self):
     object_type = 'component'
     fields = {'name': 'SIP Servlets (MSS)', 'version': 'v 1.4.0.FINAL'}
     encoded = 'urn:dje:component:SIP+Servlets+%28MSS%29:v+1.4.0.FINAL'
     assert encoded == urn.encode(object_type, **fields)
     assert object_type, fields == urn.decode(encoded)
コード例 #33
0
 def test_decode_license(self):
     u = 'urn:dje:license:lic'
     parsed = ('license', {'key': 'lic'})
     self.assertEqual(parsed, urn.decode(u))
コード例 #34
0
ファイル: test_urn.py プロジェクト: yudhik11/scancode-toolkit
 def test_decode_org(self):
     u = 'urn:dje:owner:name'
     parsed = ('owner', {'name': 'name'})
     assert parsed == urn.decode(u)