def test_dataverse_json_all_valid(self, import_dataverse_min_dict): """Test Dataverse.json() with format=`all` and valid data. Parameters ---------- import_dataverse_min_dict : dict Fixture, which returns a flat dataset dict() coming from `tests/data/dataverse_min.json`. """ data = import_dataverse_min_dict dv = Dataverse() dv.set(data) dv.datasets = [Dataset()] dv.dataverses = [Dataverse()] dv.pid = 'doi:10.11587/EVMUHP' data = dv.json('all') assert data assert isinstance(data, str)
def test_dataverse_json_format_wrong_valid(self, import_dataverse_min_dict): """Test Dataverse.json() with non-valid format and valid data. Parameters ---------- import_dataverse_min_dict : dict Fixture, which returns a flat dataset dict() coming from `tests/data/dataverse_min.json`. """ data = import_dataverse_min_dict dv = Dataverse() dv.set(data) dv.datasets = [Dataset()] dv.dataverses = [Dataverse()] dv.pid = 'doi:10.11587/EVMUHP' data = dv.json('wrong') assert not data
def test_dataverse_dict_all_valid(self, import_dataverse_min_dict): """Test Dataverse.dict() with format=`all` and valid data. Parameters ---------- import_dataverse_min_dict : dict Fixture, which returns a flat dataset dict() coming from `tests/data/dataverse_min.json`. """ data = import_dataverse_min_dict dv = Dataverse() dv.set(data) dv.datasets = [Dataset()] dv.dataverses = [Dataverse()] dv.pid = 'doi:10.11587/EVMUHP' data = dv.dict('all') assert data assert isinstance(data, dict) assert data['alias'] == 'test-pyDataverse' assert data['name'] == 'Test pyDataverse' assert data['dataverseContacts'][0]['contactEmail'] == '*****@*****.**' assert data['pid'] == 'doi:10.11587/EVMUHP'