-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathtest_lists.py
55 lines (42 loc) · 1.83 KB
/
test_lists.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
import unittest
from intermine.webservice import *
from intermine.lists.list import List
from tests.test_core import WebserviceTest
class TestLists(WebserviceTest): # pragma: no cover
def setUp(self):
self.service = Service(self.get_test_root())
def testGetLists(self):
"""Should be able to get lists from a service"""
self.assertEqual(self.service.get_list_count(), 3)
list_a = self.service.get_list("test-list-1")
self.assertTrue(list_a.description, "An example test list")
self.assertEqual(list_a.size, 42)
self.assertEqual(list_a.count, 42)
self.assertEqual(len(list_a), 42)
self.assertEqual(list_a.title, "test1")
self.assertTrue(list_a.is_authorized)
self.assertEqual(list_a.list_type, "Employee")
self.assertEqual(list_a.tags, frozenset(["tag1", "tag2", "tag3"]))
list_a = self.service.get_list("test-list-2")
self.assertTrue(list_a.description, "Another example test list")
self.assertEqual(list_a.size, 7)
self.assertEqual(len(list_a), 7)
self.assertEqual(list_a.count, 7)
self.assertTrue(not list_a.is_authorized)
self.assertEqual(list_a.tags, frozenset([]))
list_c = self.service.get_list("test-list-3")
self.assertTrue(list_c.description, "Yet Another example test list")
self.assertEqual(list_c.size, 8)
self.assertTrue(list_c.is_authorized)
def alter_size():
list_a.size = 10
def alter_type():
list_a.list_type = "foo"
self.assertRaises(AttributeError, alter_size)
self.assertRaises(AttributeError, alter_type)
def testBadListConstruction(self):
args = {}
self.assertRaises(ValueError, lambda: List(**args))
def tearDown(self):
s = self.service
s.__del__()