示例#1
0
    def test_constructor(self):
        """Tests the proper constructor values are set"""
        client = self._new_client()
        self.assertEqual(client.baseurl['scheme'], 'http',
                         'Scheme not set to http as spected for baseurl!')
        self.assertEqual(client.baseurl['host'], 'brutus.library.emory.edu',
                         'Host not correctly set for baseurl!')
        self.assertEqual(client.baseurl['path'], '/pidman',
                         'Path not correctly set for baseurl!')

        # url with trailing slash - treated same as without
        client = PidmanRestClient('%s/' % self.baseurl)
        self.assertEqual(
            client.baseurl['path'], '/pidman',
            'Path not correctly set when baseurl specified with trailing slash'
        )
示例#2
0
        # validate that each arg starts with http and ends with a port number
        validate(new_url_base, fedora_url)
    else:
        print '\nError: argument list incomplete. See usage example below.'
        usage()
        sys.exit()

    global repo
    repo = Repository(fedora_url,
                      username=fedora_username,
                      password=fedora_password)

    #Pidman Client
    global client
    client = PidmanRestClient(db_baseurl, db_username, db_password)
    connection = client._get_connection()

    current_page = 1
    count = 0
    max = 10000

    # search for existing arks by domain where type='ark', domain='LSDI'
    search_results = client.search_pids(type='ark',
                                        domain='Rushdie Collection',
                                        count=max)
    total_pages = search_results['page_count']
    page_link_1 = search_results['first_page_link']
    page_link = page_link_1[0:-1]

    print "\n=> Processing page[%d] that contains [%d] of a total of [%d] pages ..." % (
示例#3
0
 def _new_client(self):
     """
     Initialize client with configured settings for testing.
     """
     return PidmanRestClient(self.baseurl, self.username, self.password)