99
1010TEST_ASSET_DIR = os .path .join (os .path .dirname (__file__ ), "assets" )
1111
12+ GET_VIEW_XML = os .path .join (TEST_ASSET_DIR , "view_get.xml" )
1213GET_XML_PAGE1 = os .path .join (TEST_ASSET_DIR , "workbook_get_page_1.xml" )
1314GET_XML_PAGE2 = os .path .join (TEST_ASSET_DIR , "workbook_get_page_2.xml" )
1415GET_XML_PAGE3 = os .path .join (TEST_ASSET_DIR , "workbook_get_page_3.xml" )
@@ -35,7 +36,7 @@ def setUp(self):
3536
3637 self .baseurl = self .server .workbooks .baseurl
3738
38- def test_pager_with_no_options (self ):
39+ def test_pager_with_no_options (self ) -> None :
3940 with open (GET_XML_PAGE1 , "rb" ) as f :
4041 page_1 = f .read ().decode ("utf-8" )
4142 with open (GET_XML_PAGE2 , "rb" ) as f :
@@ -61,7 +62,7 @@ def test_pager_with_no_options(self):
6162 self .assertEqual (wb2 .name , "Page2Workbook" )
6263 self .assertEqual (wb3 .name , "Page3Workbook" )
6364
64- def test_pager_with_options (self ):
65+ def test_pager_with_options (self ) -> None :
6566 with open (GET_XML_PAGE1 , "rb" ) as f :
6667 page_1 = f .read ().decode ("utf-8" )
6768 with open (GET_XML_PAGE2 , "rb" ) as f :
@@ -102,14 +103,22 @@ def test_pager_with_options(self):
102103 wb3 = workbooks .pop ()
103104 self .assertEqual (wb3 .name , "Page3Workbook" )
104105
105- def test_pager_with_env_var (self ):
106+ def test_pager_with_env_var (self ) -> None :
106107 with set_env (TSC_PAGE_SIZE = "1000" ):
107108 assert config .PAGE_SIZE == 1000
108109 loop = TSC .Pager (self .server .workbooks )
109110 assert loop ._options .pagesize == 1000
110111
111- def test_queryset_with_env_var (self ):
112+ def test_queryset_with_env_var (self ) -> None :
112113 with set_env (TSC_PAGE_SIZE = "1000" ):
113114 assert config .PAGE_SIZE == 1000
114115 loop = self .server .workbooks .all ()
115116 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