-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathproject_tests.py
63 lines (48 loc) · 1.58 KB
/
project_tests.py
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
from dataikuapi.dssclient import DSSClient
from nose.tools import ok_
from nose.tools import eq_
host="http://localhost:8082"
apiKey="ZZYqWxPnc2nWMJMUXwykn6wzA7jokbp5"
testProjectKey="MYSQL"
def list_projects_test():
client = DSSClient(host, apiKey)
projects = client.list_project_keys()
ok_(len(projects) > 0)
def project_metadata_test():
client = DSSClient(host, apiKey)
project = client.get_project(testProjectKey)
meta = project.get_metadata()
ok_(meta is not None)
project.set_metadata(meta)
def project_permissions_test():
client = DSSClient(host, apiKey)
project = client.get_project(testProjectKey)
perms = project.get_permissions()
ok_(perms is not None)
project.set_permissions(perms)
def project_create_delete_test():
client = DSSClient(host, apiKey)
count = len(client.list_project_keys())
p = client.create_project("toto","name of toto", "me")
eq_(count + 1, len(client.list_project_keys()))
p.delete()
eq_(count, len(client.list_project_keys()))
"""
def sql_test():
client = DSSClient(host, apiKey)
projects = client.list_project_keys()
projectKey = projects[0]['projectKey']
p = client.get_project(projectKey)
q = p.sql_query('select * from train_set_pg limit 5', 'local_postgress')
for r in q.iter_rows():
print(r)
q.verify()
def project_export_stream_test():
client = DSSClient(host, apiKey)
with client.get_project('PARTITIONED').get_export_stream() as e:
with open('export.zip', 'w') as f:
f.write(e.read())
def project_export_file_test():
client = DSSClient(host, apiKey)
client.get_project('PARTITIONED').export_to_file("ex2.zip")
"""