@@ -65,11 +65,11 @@ def test_format_term_replace(self):
6565class TestConnection (object ):
6666
6767 def test_connect (self ):
68- c = Connection (TEST_HOST , TEST_TOKEN )
68+ connection = Connection (TEST_HOST , TEST_TOKEN )
6969
70- assert c .host == TEST_HOST
71- assert c .token == TEST_TOKEN
72- assert c .service_document
70+ assert connection .host == TEST_HOST
71+ assert connection .token == TEST_TOKEN
72+ assert connection .service_document
7373
7474 def test_connect_unauthorized (self ):
7575 with pytest .raises (exceptions .UnauthorizedError ):
@@ -86,6 +86,36 @@ def test_connect_unknown_failure(self):
8686 with pytest .raises (exceptions .ConnectionError ):
8787 Connection (TEST_HOST , TEST_TOKEN )
8888
89+ def test_create_dataverse (self ):
90+ connection = Connection (TEST_HOST , TEST_TOKEN )
91+ alias = str (uuid .uuid1 ()) # must be unique
92+ connection .create_dataverse (
93+ alias ,
94+ 'Test Name' ,
95+ 'dataverse@example.com' ,
96+ )
97+
98+ dataverse = connection .get_dataverse (alias , True )
99+ try :
100+ assert dataverse .alias == alias
101+ assert dataverse .title == 'Test Name'
102+ finally :
103+ connection .delete_dataverse (alias )
104+
105+ def test_delete_dataverse (self ):
106+ connection = Connection (TEST_HOST , TEST_TOKEN )
107+ alias = str (uuid .uuid1 ()) # must be unique
108+ connection .create_dataverse (
109+ alias ,
110+ 'Test Name' ,
111+ 'dataverse@example.com' ,
112+ )
113+
114+ connection .delete_dataverse (alias )
115+ dataverse = connection .get_dataverse (alias , True )
116+
117+ assert dataverse is None
118+
89119
90120class TestDataset (object ):
91121
0 commit comments