Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Andrew Buddenberg
gcis-py-client
Commits
33b8d85d
Commit
33b8d85d
authored
Aug 24, 2015
by
abuddenberg
Browse files
Add Parent test cases; others.
parent
bb90ecb3
Changes
1
Hide whitespace changes
Inline
Side-by-side
gcis_clients/test/test_suite.py
View file @
33b8d85d
...
...
@@ -9,7 +9,7 @@ import json
import
pytest
from
test_data
import
test_figure_json
,
test_image_json
,
webform_json_precip
,
test_dataset_json
from
gcis_clients.domain
import
Gcisbase
,
Figure
,
Image
,
Dataset
,
Chapter
,
Contributor
from
gcis_clients.domain
import
Gcisbase
,
Figure
,
Image
,
Dataset
,
Chapter
,
Contributor
,
Parent
from
gcis_clients
import
GcisClient
import
__builtin__
from
os
import
getenv
...
...
@@ -52,6 +52,10 @@ def test_gcis_client_init_modes(monkeypatch, capsys):
assert
gcis
.
base_url
==
'http://data.globalchange.gov'
assert
gcis
.
s
.
auth
==
(
test_user
,
test_apikey
)
#Test trailing slash in base URL
gcis
=
GcisClient
(
'http://data.globalchange.gov/'
,
test_user
,
test_apikey
)
assert
gcis
.
base_url
==
'http://data.globalchange.gov'
def
test_get_credentials_modes
(
monkeypatch
):
test_user
=
'test.user@domain.com'
...
...
@@ -168,12 +172,35 @@ def test_dataset_special_properties():
ds_json_out
=
json
.
loads
(
ds
.
as_json
())
assert
ds_json_out
[
'access_dt'
]
==
'2011-12-31T00:00:00'
#Make sure identifier doesn't get nulled out if we don't specify known_ids
assert
ds
.
identifier
==
'cddv2'
# def test_contributors():
# f = Figure(json.loads(test_figure_json))
# contribs = f.contributors
def
test_parent
():
f
=
Figure
(
json
.
loads
(
test_figure_json
))
assert
f
.
parents
==
[]
ds
=
Dataset
(
json
.
loads
(
test_dataset_json
))
assert
isinstance
(
ds
,
Dataset
)
p
=
Parent
.
from_obj
(
ds
)
assert
isinstance
(
p
,
Parent
)
assert
isinstance
(
p
.
publication
,
Dataset
)
f
.
add_parent
(
p
)
assert
len
(
f
.
parents
)
==
1
assert
f
.
parents
[
0
]
==
p
assert
f
.
parents
[
0
].
relationship
==
'prov:wasDerivedFrom'
assert
f
.
parents
[
0
].
publication_type_identifier
==
'dataset'
assert
f
.
parents
[
0
].
url
==
'/dataset/cddv2'
assert
f
.
parents
[
0
].
label
==
'Climate Division Database Version 2'
if
__name__
==
"__main__"
and
__package__
is
None
:
__package__
=
"gcis_client.test.test_suite"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment