コード例 #1
0
 def testGnTransactionDelete(self):
     response = gn_transaction_delete('df_dk_0010001_0192', gn_settings['gn_username'], gn_settings['gn_password'], self.logger)
     self.assertIsNotNone(response, 'Function gn_transaction_delete - Failed because response is None.')
     self.assertTrue(isinstance(response, unicode), 'Function gn_transaction_delete - Failed because response is not a unicode.')
     
     print 'Test response for function - gn_transaction_delete'
     print '=================================================='
     print response
コード例 #2
0
    def testGnTransactionInsert(self):
        try:
            tmpDirectory = tempfile.mkdtemp('', 'tmp_', templates['tmp_dir'])
            mdFile = createTemporaryCopy(templates['child'], tmpDirectory)
            metadata = getMetadataForMesstischblatt(71051490, self.dbSession, self.logger)
            updateMetadata(mdFile, metadata, self.logger)

            response = gn_transaction_insert(mdFile,gn_settings['gn_username'], gn_settings['gn_password'], self.logger)
            self.assertIsNotNone(response, 'Function gn_transaction_insert - Failed because response is None.')
            self.assertTrue(isinstance(response, unicode), 'Function gn_transaction_insert - Failed because response is not a unicode.')
            self.assertTrue('<csw:totalInserted>1</csw:totalInserted>' in response, 
                            'Function gn_transaction_insert - Failed because no record insert.')
    
            print 'Test response for function - gn_transaction_insert'
            print '=================================================='
            print response
    
        except:
            raise
        finally:
            shutil.rmtree(tmpDirectory)
            gn_transaction_delete(metadata['identifier'], gn_settings['gn_username'], gn_settings['gn_password'], self.logger)