示例#1
0
    def test_dataverse_import_metadata_dv_up(self):
        """Test Dataverse.import_metadata() with format=`dv_up`."""
        dv = Dataverse()
        dv.import_metadata(TEST_DIR + '/data/dataverse_min.json')

        assert isinstance(dv.datasets, list)
        assert not dv.datasets
        assert isinstance(dv.dataverses, list)
        assert not dv.dataverses
        assert not dv.pid
        assert dv.alias == 'test-pyDataverse'
        assert dv.name == 'Test pyDataverse'
        assert isinstance(dv.dataverseContacts, list)
        assert len(dv.dataverseContacts) == 1
        assert dv.dataverseContacts[0]['contactEmail'] == '*****@*****.**'
示例#2
0
    def test_dataverse_import_metadata_format_wrong(self):
        """Test Dataverse.import_metadata() with non-valid format."""
        dv = Dataverse()
        dv.import_metadata(TEST_DIR + '/data/dataverse_min.json', 'wrong')

        assert isinstance(dv.datasets, list)
        assert len(dv.datasets) == 0
        assert not dv.datasets
        assert isinstance(dv.dataverses, list)
        assert len(dv.dataverses) == 0
        assert not dv.dataverses
        assert not dv.pid
        assert not dv.name
        assert not dv.alias
        assert isinstance(dv.dataverseContacts, list)
        assert len(dv.dataverseContacts) == 0
        assert not dv.dataverseContacts
        assert not dv.affiliation
        assert not dv.description
        assert not dv.dataverseType