Esempio n. 1
0
    def test_correct_metadata_collection(self):
        """Test_format_metadata - collection of metadata without errors"""

        marcxml = open("%s%sTest_marcxml_file_3.xml" % (TEST_DATA, os.sep)).read()

        metadata = {}
        metadata['primary_label'] = 'Test - Test Disruptive Networks'
        metadata['primary_url'] = 'http://arxiv.org/terms/arXiv/test.dis-nn'

        user_info = {}
        user_info['nickname'] = 'test_user'
        user_info['email'] = '*****@*****.**'

        deposit_results = []
        deposit_results.append(open("%s%sTest_media_deposit.xml" % (TEST_DATA, os.sep)).read())
        metadata = format_metadata(marcxml, deposit_results, user_info, metadata)

        self.assertEqual(metadata['id'], "ATL-PHYS-CONF-2007-008")
        self.assertEqual(metadata['title'],  "Early Standard Model physics and early discovery strategy in ATLAS")
        self.assertEqual(metadata['contributors'][0]['name'], "Grosse-Knetter, J")
        self.assertEqual(metadata['contributors'][0]['affiliation'][0], "Bonn U.")
        self.assertEqual(metadata['summary'], "In 2008 the LHC will open a new energy domain for physics within the Standard Model and beyond. The physics channels which will be addressed by the ATLAS experiment in the initial period of operation will be discussed. These include Standard Model processes such as W/Z production and early top measurements. This will be followed by a description of the searches for a low-mass Higgs boson, new heavy di-lepton resonances, and Supersymmetry, for which a striking signal might be observed after only a few months of data taking.")
        nb_contributors = len(metadata['contributors'])
        self.assertEqual(nb_contributors, 1)
        self.assertEqual(metadata['doi'], "")
        self.assertEqual(len(metadata['journal_refs']), 1)
        self.assertEqual(metadata['journal_refs'][0], "Nucl. Phys. B, Proc. Suppl.: 55-59 (2008) pp. 177-178")
        self.assertEqual(len(metadata['report_nos']), 2)
        self.assertEqual(metadata['report_nos'][0], "ATL-COM-PHYS-2007-036")
        self.assertEqual(metadata['report_nos'][1], "CERN-ATL-COM-PHYS-2007-036")
        self.assertEqual(metadata['comment'], "")

        self.assertEqual(metadata['primary_label'], "Test - Test Disruptive Networks")
        self.assertEqual(metadata['primary_url'], "http://arxiv.org/terms/arXiv/test.dis-nn")

        self.assertEqual(metadata['author_name'], "test_user")
        self.assertEqual(metadata['author_email'], "*****@*****.**")

        self.assertEqual(metadata['links']['link'], "https://arxiv.org/sword-app/edit/10070072")
        self.assertEqual(metadata['links']['type'], "application/pdf")
Esempio n. 2
0
    def test_correct_metadata_collection(self):
        """Test_format_metadata - collection of metadata without errors"""

        marcxml = open("%s%sTest_marcxml_file_3.xml" % (TEST_DATA, os.sep)).read()

        metadata = {}
        metadata['primary_label'] = 'Test - Test Disruptive Networks'
        metadata['primary_url'] = 'http://arxiv.org/terms/arXiv/test.dis-nn'

        user_info = {}
        user_info['nickname'] = 'test_user'
        user_info['email'] = '*****@*****.**'

        deposit_results = []
        deposit_results.append(open("%s%sTest_media_deposit.xml" % (TEST_DATA, os.sep)).read())
        metadata = format_metadata(marcxml, deposit_results, user_info, metadata)

        self.assertEqual(metadata['id'], "ATL-PHYS-CONF-2007-008")
        self.assertEqual(metadata['title'],  "Early Standard Model physics and early discovery strategy in ATLAS")
        self.assertEqual(metadata['contributors'][0]['name'], "Grosse-Knetter, J")
        self.assertEqual(metadata['contributors'][0]['affiliation'][0], "Bonn U.")
        self.assertEqual(metadata['summary'], "In 2008 the LHC will open a new energy domain for physics within the Standard Model and beyond. The physics channels which will be addressed by the ATLAS experiment in the initial period of operation will be discussed. These include Standard Model processes such as W/Z production and early top measurements. This will be followed by a description of the searches for a low-mass Higgs boson, new heavy di-lepton resonances, and Supersymmetry, for which a striking signal might be observed after only a few months of data taking.")
        nb_contributors = len(metadata['contributors'])
        self.assertEqual(nb_contributors, 1)
        self.assertEqual(metadata['doi'], "")
        self.assertEqual(len(metadata['journal_refs']), 1)
        self.assertEqual(metadata['journal_refs'][0], "Nucl. Phys. B, Proc. Suppl.: 55-59 (2008) pp. 177-178")
        self.assertEqual(len(metadata['report_nos']), 2)
        self.assertEqual(metadata['report_nos'][0], "ATL-COM-PHYS-2007-036")
        self.assertEqual(metadata['report_nos'][1], "CERN-ATL-COM-PHYS-2007-036")
        self.assertEqual(metadata['comment'], "")

        self.assertEqual(metadata['primary_label'], "Test - Test Disruptive Networks")
        self.assertEqual(metadata['primary_url'], "http://arxiv.org/terms/arXiv/test.dis-nn")

        self.assertEqual(metadata['author_name'], "test_user")
        self.assertEqual(metadata['author_email'], "*****@*****.**")

        self.assertEqual(metadata['links']['link'], "https://arxiv.org/sword-app/edit/10070072")
        self.assertEqual(metadata['links']['type'], "application/pdf")
Esempio n. 3
0
    def test_metadata_collection_no_data(self):
        """Test_format_metadata - collection of metadata without any changes"""

        # Gives an empty marcxml file
        marcxml = ""
        # Gives no metadata
        metadata = {}
        # Gives no user informations
        user_info = {}
        # Gives no result where to find a link
        deposit_results = []

        metadata = format_metadata(marcxml, deposit_results, user_info, metadata)
        self.assertEquals(len(metadata['error']), 9)
        self.assertEquals(metadata['error'][0], "No submitter name given !")
        self.assertEquals(metadata['error'][1], "No submitter email given !")
        self.assertEquals(metadata['error'][2], "No primary category label given !")
        self.assertEquals(metadata['error'][3], "No primary category url given !")
        self.assertEquals(metadata['error'][4], "No links to the media deposit found !")
        self.assertEquals(metadata['error'][5], "No document id given !")
        self.assertEquals(metadata['error'][6], "No title given !")
        self.assertEquals(metadata['error'][7], "No author given !")
        self.assertEquals(metadata['error'][8], "No summary given !")


        self.assertEquals(metadata['id'], "")
        self.assertEquals(metadata['title'], "")
        self.assertEqual(len(metadata['contributors']), 0)
        self.assertEqual(metadata['summary'], "")
        self.assertEqual(metadata['doi'], "")
        self.assertEqual(len(metadata['journal_refs']), 0)
        self.assertEqual(len(metadata['report_nos']), 0)
        self.assertEqual(metadata['comment'], "")
        self.assertEqual(metadata['primary_label'], "")
        self.assertEqual(metadata['primary_url'], "")
        self.assertEqual(metadata['author_name'], "")
        self.assertEqual(metadata['author_email'], "")
        self.assertEqual(len(metadata['links']), 0)
Esempio n. 4
0
    def test_metadata_collection_no_data(self):
        """Test_format_metadata - collection of metadata without any changes"""

        # Gives an empty marcxml file
        marcxml = ""
        # Gives no metadata
        metadata = {}
        # Gives no user informations
        user_info = {}
        # Gives no result where to find a link
        deposit_results = []

        metadata = format_metadata(marcxml, deposit_results, user_info, metadata)
        self.assertEquals(len(metadata['error']), 9)
        self.assertEquals(metadata['error'][0], "No submitter name given !")
        self.assertEquals(metadata['error'][1], "No submitter email given !")
        self.assertEquals(metadata['error'][2], "No primary category label given !")
        self.assertEquals(metadata['error'][3], "No primary category url given !")
        self.assertEquals(metadata['error'][4], "No links to the media deposit found !")
        self.assertEquals(metadata['error'][5], "No document id given !")
        self.assertEquals(metadata['error'][6], "No title given !")
        self.assertEquals(metadata['error'][7], "No author given !")
        self.assertEquals(metadata['error'][8], "No summary given !")


        self.assertEquals(metadata['id'], "")
        self.assertEquals(metadata['title'], "")
        self.assertEqual(len(metadata['contributors']), 0)
        self.assertEqual(metadata['summary'], "")
        self.assertEqual(metadata['doi'], "")
        self.assertEqual(len(metadata['journal_refs']), 0)
        self.assertEqual(len(metadata['report_nos']), 0)
        self.assertEqual(metadata['comment'], "")
        self.assertEqual(metadata['primary_label'], "")
        self.assertEqual(metadata['primary_url'], "")
        self.assertEqual(metadata['author_name'], "")
        self.assertEqual(metadata['author_email'], "")
        self.assertEqual(len(metadata['links']), 0)