4545url = https://three.url
4646private_token = MNOPQR
4747ssl_verify = /path/to/CA/bundle.crt
48+ per_page = 50
4849
4950[four]
5051url = https://four.url
6667
6768[three]
6869meh = hem
70+
71+ [four]
72+ url = http://four.url
73+ private_token = ABCDEF
74+ per_page = 200
6975"""
7076
7177
@@ -87,13 +93,19 @@ def test_invalid_id(self, m_open):
8793 @mock .patch ('six.moves.builtins.open' )
8894 def test_invalid_data (self , m_open ):
8995 fd = six .StringIO (missing_attr_config )
90- fd .close = mock .Mock (return_value = None )
96+ fd .close = mock .Mock (return_value = None ,
97+ side_effect = lambda : fd .seek (0 ))
9198 m_open .return_value = fd
9299 config .GitlabConfigParser ('one' )
100+ config .GitlabConfigParser ('one' )
93101 self .assertRaises (config .GitlabDataError , config .GitlabConfigParser ,
94102 gitlab_id = 'two' )
95103 self .assertRaises (config .GitlabDataError , config .GitlabConfigParser ,
96104 gitlab_id = 'three' )
105+ with self .assertRaises (config .GitlabDataError ) as emgr :
106+ config .GitlabConfigParser ('four' )
107+ self .assertEqual ('Unsupported per_page number: 200' ,
108+ emgr .exception .args [0 ])
97109
98110 @mock .patch ('six.moves.builtins.open' )
99111 def test_valid_data (self , m_open ):
@@ -108,6 +120,7 @@ def test_valid_data(self, m_open):
108120 self .assertEqual (None , cp .oauth_token )
109121 self .assertEqual (2 , cp .timeout )
110122 self .assertEqual (True , cp .ssl_verify )
123+ self .assertIsNone (cp .per_page )
111124
112125 fd = six .StringIO (valid_config )
113126 fd .close = mock .Mock (return_value = None )
@@ -130,6 +143,7 @@ def test_valid_data(self, m_open):
130143 self .assertEqual (None , cp .oauth_token )
131144 self .assertEqual (2 , cp .timeout )
132145 self .assertEqual ("/path/to/CA/bundle.crt" , cp .ssl_verify )
146+ self .assertEqual (50 , cp .per_page )
133147
134148 fd = six .StringIO (valid_config )
135149 fd .close = mock .Mock (return_value = None )
0 commit comments