@@ -45,6 +45,8 @@ def __init__(self, installation_type="normal", test_type="install"):
4545 self .result &= self .test_client_auth_file ()
4646 if self .test_type == "install" :
4747 self .result &= self .test_boinc_master_user_only_exists ()
48+ if self .installation_type == "test_proj_init_file" :
49+ self .result &= self .test_proj_init_file ()
4850
4951 def _get_test_executable_file_path (self , filename ):
5052 return pathlib .Path ("C:\\ Program Files\\ BOINC\\ " ) / filename
@@ -248,13 +250,54 @@ def test_login_token_file(self):
248250
249251 return ts .result ()
250252
253+ def test_proj_init_file (self ):
254+ ts = testset .TestSet ("Test project init file" )
255+ project_init_file = self ._get_test_data_file_path ("project_init.xml" )
256+ ts .expect_true (os .path .exists (project_init_file ), "Test 'project_init.xml' file exists in 'C:\\ ProgramData\\ BOINC\\ '" )
257+
258+ if os .path .exists (project_init_file ):
259+ try :
260+ tree = ET .parse (project_init_file )
261+ root = tree .getroot ()
262+
263+ ts .expect_equal ("project_init" , root .tag , "Test root element is 'project_init'" )
264+
265+ url_element = root .find ("url" )
266+ name_element = root .find ("name" )
267+ account_key_element = root .find ("account_key" )
268+ embedded_element = root .find ("embedded" )
269+
270+ ts .expect_true (url_element is not None , "Test 'url' element exists" )
271+ ts .expect_true (name_element is not None , "Test 'name' element exists" )
272+ ts .expect_true (account_key_element is not None , "Test 'account_key' element exists" )
273+ ts .expect_true (embedded_element is not None , "Test 'embedded' element exists" )
274+
275+ if url_element is not None :
276+ ts .expect_equal ("https://test.com" , url_element .text , "Test 'url' element contains 'https://test.com'" )
277+
278+ if name_element is not None :
279+ ts .expect_equal ("test" , name_element .text , "Test 'name' element contains 'test'" )
280+
281+ if account_key_element is not None :
282+ ts .expect_equal ("abcdef1234567890" , account_key_element .text , "Test 'account_key' element contains 'abcdef1234567890'" )
283+
284+ if embedded_element is not None :
285+ ts .expect_equal ("0" , embedded_element .text , "Test 'embedded' element contains '0'" )
286+
287+ except ET .ParseError as e :
288+ ts .expect_true (False , f"Test XML file is well-formed (Parse error: { e } )" )
289+ except Exception as e :
290+ ts .expect_true (False , f"Test XML file can be processed (Error: { e } )" )
291+
292+ return ts .result ()
293+
251294if __name__ == "__main__" :
252295 parser = argparse .ArgumentParser (description = "BOINC Windows Installer Integration Tests" )
253296 parser .add_argument (
254297 "--installation-type" ,
255298 type = str ,
256299 default = "normal" ,
257- help = "Installation type: 'normal' (default), 'service', 'test_acct_mgr_login', or 'test_client_auth_file '"
300+ help = "Installation type: 'normal' (default), 'service', 'test_acct_mgr_login', 'test_client_auth_file', or 'test_proj_init_file '"
258301 )
259302 parser .add_argument (
260303 "--type" ,
0 commit comments