-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathfixtures.py
More file actions
85 lines (62 loc) · 2.38 KB
/
fixtures.py
File metadata and controls
85 lines (62 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import pytest
import os
import json
from waterbutler.providers.dataverse.metadata import (
DataverseDatasetMetadata,
DataverseRevision,
DataverseFileMetadata
)
@pytest.fixture
def auth():
return {
'name': 'cat',
'email': 'cat@cat.com',
}
@pytest.fixture
def credentials():
return {'token': 'wrote harry potter'}
@pytest.fixture
def settings():
return {
'host': 'myfakehost.dataverse.org',
'doi': 'doi:10.5072/FK2/ABCDEF',
'id': '18',
'name': 'A look at wizards',
}
@pytest.fixture
def native_file_metadata():
with open(os.path.join(os.path.dirname(__file__), 'fixtures/root_provider.json'), 'r') as fp:
return json.load(fp)['native_file_metadata']
@pytest.fixture
def native_dataset_metadata():
with open(os.path.join(os.path.dirname(__file__), 'fixtures/root_provider.json'), 'r') as fp:
return json.load(fp)['native_dataset_metadata']
@pytest.fixture
def empty_native_dataset_metadata():
with open(os.path.join(os.path.dirname(__file__), 'fixtures/root_provider.json'), 'r') as fp:
return json.load(fp)['empty_native_dataset_metadata']
@pytest.fixture
def checksum_mismatch_dataset_metadata():
with open(os.path.join(os.path.dirname(__file__), 'fixtures/root_provider.json'), 'r') as fp:
return json.load(fp)['checksum_mismatch_dataset_metadata']
@pytest.fixture
def dataset_metadata_object():
with open(os.path.join(os.path.dirname(__file__), 'fixtures/root_provider.json'), 'r') as fp:
return DataverseDatasetMetadata(
json.load(fp)['native_dataset_metadata']['data'],
'Dataset Test Name',
'Dataset Test DOI',
'Dataset Test Version'
)
@pytest.fixture
def file_metadata_object():
with open(os.path.join(os.path.dirname(__file__), 'fixtures/root_provider.json'), 'r') as fp:
return DataverseFileMetadata(json.load(fp)['native_file_metadata']['datafile'], 'latest')
@pytest.fixture
def csv_file_metadata_object():
with open(os.path.join(os.path.dirname(__file__), 'fixtures/root_provider.json'), 'r') as fp:
return DataverseFileMetadata(json.load(fp)['csv_native_file_metadata']['datafile'],
'latest')
@pytest.fixture
def revision_metadata_object():
return DataverseRevision('Test Dataset Verision')