Ejemplo n.º 1
0
    def test_permission_agents(self):
        
        triples = {'subjects': [
                        'http://example.com',
                        'http://testing.org',
                        'http://testing.net',],
                   'triples': {
                       'http://example.com': {
                           CC('morePermissions'):[
                               'http://testing.com',],
                           CC('commercialLicense'):[
                               'http://testing.org',],
                           },
                       'http://testing.org': {
                           DCT('publisher'):['http://testing.net'],
                           },
                       'http://testing.net': {
                           DCT('title'): ['Testing']
                          }                           
                       }
                   }
        
        mperms = metadata.more_permissions('http://example.com', triples)

        self.assertEqual(mperms['morePermissionsURLs'], ['http://testing.com'])
        self.assertEqual(mperms['commercialLicense'], 'http://testing.org')
        self.assertEqual(mperms['morePermAgent'], 'Testing')
Ejemplo n.º 2
0
    def test_single_more_permissions_url(self):

        triples = {
            'subjects': ['http://example.com'],
            'triples': {
                'http://example.com': {
                    CC('morePermissions'): ['http://testing.com']
                }
            }
        }

        mperms = metadata.more_permissions('http://example.com', triples)

        self.assertEqual(mperms['morePermissionsURLs'], ['http://testing.com'])
        self.assertEqual(mperms['commercialLicense'], '')
        self.assertEqual(mperms['morePermAgent'], '')
Ejemplo n.º 3
0
    def test_single_more_permissions_url(self):
        
        triples = {'subjects': [
                        'http://example.com'],
                   'triples': {
                       'http://example.com': {
                           CC('morePermissions'):[
                               'http://testing.com']
                           }
                       }
                   }

        mperms = metadata.more_permissions('http://example.com', triples)

        self.assertEqual(mperms['morePermissionsURLs'], ['http://testing.com'])
        self.assertEqual(mperms['commercialLicense'], '')
        self.assertEqual(mperms['morePermAgent'], '')
Ejemplo n.º 4
0
    def test_no_more_permissions(self):

        triples = {'subjects': [
                        'http://example.com',],
                   'triples': {
                       'http://example.com' : {
                           CC('license') : [
                               'http://creativecommons.org/licenses/by/3.0/'],
                           }
                       }
                   }

        mperms = metadata.more_permissions('http://example.com',triples)

        self.assertEqual(mperms['morePermissionsURLs'], '')
        self.assertEqual(mperms['commercialLicense'], '')
        self.assertEqual(mperms['morePermAgent'], '')