9
9
10
10
TEST_ASSET_DIR = os .path .join (os .path .dirname (__file__ ), "assets" )
11
11
12
+ GET_VIEW_XML = os .path .join (TEST_ASSET_DIR , "view_get.xml" )
12
13
GET_XML_PAGE1 = os .path .join (TEST_ASSET_DIR , "workbook_get_page_1.xml" )
13
14
GET_XML_PAGE2 = os .path .join (TEST_ASSET_DIR , "workbook_get_page_2.xml" )
14
15
GET_XML_PAGE3 = os .path .join (TEST_ASSET_DIR , "workbook_get_page_3.xml" )
@@ -35,7 +36,7 @@ def setUp(self):
35
36
36
37
self .baseurl = self .server .workbooks .baseurl
37
38
38
- def test_pager_with_no_options (self ):
39
+ def test_pager_with_no_options (self ) -> None :
39
40
with open (GET_XML_PAGE1 , "rb" ) as f :
40
41
page_1 = f .read ().decode ("utf-8" )
41
42
with open (GET_XML_PAGE2 , "rb" ) as f :
@@ -61,7 +62,7 @@ def test_pager_with_no_options(self):
61
62
self .assertEqual (wb2 .name , "Page2Workbook" )
62
63
self .assertEqual (wb3 .name , "Page3Workbook" )
63
64
64
- def test_pager_with_options (self ):
65
+ def test_pager_with_options (self ) -> None :
65
66
with open (GET_XML_PAGE1 , "rb" ) as f :
66
67
page_1 = f .read ().decode ("utf-8" )
67
68
with open (GET_XML_PAGE2 , "rb" ) as f :
@@ -102,14 +103,22 @@ def test_pager_with_options(self):
102
103
wb3 = workbooks .pop ()
103
104
self .assertEqual (wb3 .name , "Page3Workbook" )
104
105
105
- def test_pager_with_env_var (self ):
106
+ def test_pager_with_env_var (self ) -> None :
106
107
with set_env (TSC_PAGE_SIZE = "1000" ):
107
108
assert config .PAGE_SIZE == 1000
108
109
loop = TSC .Pager (self .server .workbooks )
109
110
assert loop ._options .pagesize == 1000
110
111
111
- def test_queryset_with_env_var (self ):
112
+ def test_queryset_with_env_var (self ) -> None :
112
113
with set_env (TSC_PAGE_SIZE = "1000" ):
113
114
assert config .PAGE_SIZE == 1000
114
115
loop = self .server .workbooks .all ()
115
116
assert loop .request_options .pagesize == 1000
117
+
118
+ def test_pager_view (self ) -> None :
119
+ with open (GET_VIEW_XML , "rb" ) as f :
120
+ view_xml = f .read ().decode ("utf-8" )
121
+ with requests_mock .mock () as m :
122
+ m .get (self .server .views .baseurl , text = view_xml )
123
+ for view in TSC .Pager (self .server .views ):
124
+ assert view .name is not None
0 commit comments