-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathbasemount_interface_tests.py
More file actions
39 lines (31 loc) · 1.2 KB
/
basemount_interface_tests.py
File metadata and controls
39 lines (31 loc) · 1.2 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
import os
import unittest
from BaseSpacePy.api.BaseMountInterface import BaseMountInterface, BaseMountInterfaceException
def get_basemount_root():
import getpass
username = getpass.getuser()
config_name = "hoth"
basemount_root = "/basespace"
basemount_target = "%s.%s" % (username, config_name)
return os.path.join(basemount_root, basemount_target)
basemount_root = get_basemount_root()
project_path = os.path.join(basemount_root, "Projects", "BaseSpaceDemo")
project_id = '596596'
sample_path = os.path.join(project_path, "Samples", "BC_1")
sample_id = '855855'
class TestBaseMountInterace(unittest.TestCase):
def setUp(self):
pass
def test_fail_on_invalid_path(self):
with self.assertRaises(BaseMountInterfaceException):
BaseMountInterface("/tmp")
def test_extract_project_details(self):
bmi = BaseMountInterface(project_path)
self.assertEqual(bmi.type, "project")
self.assertEqual(bmi.id, project_id)
def test_extract_sample_details(self):
bmi = BaseMountInterface(sample_path)
self.assertEqual(bmi.type, "sample")
self.assertEqual(bmi.id, sample_id)
if __name__ == "__main__":
unittest.main()