forked from fgcz/bfabricPy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_bfabric_sample.py
executable file
·52 lines (42 loc) · 1.81 KB
/
test_bfabric_sample.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
#!/usr/bin/env python3
# -*- coding: latin1 -*-
"""
unittest by <cp@fgcz.ethz.ch>
"""
import unittest
from bfabric import Bfabric
"""
ssh localhost "cat > /tmp/bb.py && /usr/bin/python /tmp/bb.py" < PycharmProjects/untitled/bfabric_wsdl.py
"""
class BfabricTestCase(unittest.TestCase):
workunits = []
samples = []
bfapp = Bfabric(verbose=True)
def sample_save(self):
print("SAVE SAMPLE")
sample_type = 'Biological Sample - Proteomics'
species = "n/a"
for name in [1, 2, 3]:
res = self.bfapp.save_object(endpoint='sample', obj={'name': "unit test - #{} - {}".format(name, sample_type),
'containerid': 3000,
'type' : sample_type,
'species' : species,
'samplingdate' : "2017-10-12",
'groupingvar' : "A",
'description': '68b329da9893e34099c7d8ad5cb9c940'
})
for i in res:
print (i)
#self.samples.append(res[0].id)
def sample_delete(self):
print("SAMPLE DELETE")
print(self.samples)
res = [self.bfapp.delete_object(endpoint='sample', id=x)[0] for x in self.samples]
res = [x for x in res if "removed successfully." in x.deletionreport]
print(res)
self.assertEqual(len(res), len(self.samples))
def test_sample(self):
self.sample_save()
# self.sample_delete()
if __name__ == '__main__':
unittest.main()