0
|
1 __license__ = "MIT"
|
|
2
|
|
3 import unittest
|
|
4 import linkKEGG as lk
|
|
5
|
|
6
|
|
7 class SimpleUnitTest(unittest.TestCase):
|
|
8 def setUp(self):
|
|
9 import os
|
|
10
|
|
11 os.environ["http_proxy"] = "" # work around for IOError: [Errno url error] invalid proxy for http:
|
|
12 pass
|
|
13
|
|
14 def tearDown(self):
|
|
15 pass
|
|
16
|
|
17 def test_no_db_specified(self):
|
|
18 """should return default glycan path example"""
|
|
19 m = lk.linked_entries_from_kegg()
|
|
20 self.assertIn("path", m)
|
|
21 self.assertIn("G00001", m)
|
|
22
|
|
23
|
|
24 def test_bad_db(self):
|
|
25 """"""
|
|
26 import urllib2
|
|
27
|
|
28 with self.assertRaises(urllib2.HTTPError):
|
|
29 m = lk.linked_entries_from_kegg("john", "sally")
|
|
30
|
|
31 def test_bad_dbentry(self):
|
|
32 """"""
|
|
33 import urllib2
|
|
34
|
|
35 with self.assertRaises(urllib2.HTTPError):
|
|
36 m = lk.linked_entries_from_kegg("ko", "map000")
|
|
37
|
|
38 def test_no_links_btn_dbs(self):
|
|
39 """ should return an empty string, cannot write None to file"""
|
|
40 m = lk.linked_entries_from_kegg("br", "gl:G10496")
|
|
41 self.assertEquals(m,"")
|
|
42
|