Tests: verify and fix host.yaml/Utils.py match (#1302)
This commit is contained in:
		
							parent
							
								
									e206c065bf
								
							
						
					
					
						commit
						78d4da53a7
					
				
							
								
								
									
										8
									
								
								Utils.py
								
								
								
								
							
							
						
						
									
										8
									
								
								Utils.py
								
								
								
								
							| 
						 | 
					@ -268,7 +268,6 @@ def get_default_options() -> OptionsType:
 | 
				
			||||||
            "log_network": 0
 | 
					            "log_network": 0
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        "generator": {
 | 
					        "generator": {
 | 
				
			||||||
            "teams": 1,
 | 
					 | 
				
			||||||
            "enemizer_path": os.path.join("EnemizerCLI", "EnemizerCLI.Core"),
 | 
					            "enemizer_path": os.path.join("EnemizerCLI", "EnemizerCLI.Core"),
 | 
				
			||||||
            "player_files_path": "Players",
 | 
					            "player_files_path": "Players",
 | 
				
			||||||
            "players": 0,
 | 
					            "players": 0,
 | 
				
			||||||
| 
						 | 
					@ -286,6 +285,7 @@ def get_default_options() -> OptionsType:
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        "oot_options": {
 | 
					        "oot_options": {
 | 
				
			||||||
            "rom_file": "The Legend of Zelda - Ocarina of Time.z64",
 | 
					            "rom_file": "The Legend of Zelda - Ocarina of Time.z64",
 | 
				
			||||||
 | 
					            "rom_start": True
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        "dkc3_options": {
 | 
					        "dkc3_options": {
 | 
				
			||||||
            "rom_file": "Donkey Kong Country 3 - Dixie Kong's Double Trouble! (USA) (En,Fr).sfc",
 | 
					            "rom_file": "Donkey Kong Country 3 - Dixie Kong's Double Trouble! (USA) (En,Fr).sfc",
 | 
				
			||||||
| 
						 | 
					@ -303,9 +303,11 @@ def get_default_options() -> OptionsType:
 | 
				
			||||||
            "red_rom_file": "Pokemon Red (UE) [S][!].gb",
 | 
					            "red_rom_file": "Pokemon Red (UE) [S][!].gb",
 | 
				
			||||||
            "blue_rom_file": "Pokemon Blue (UE) [S][!].gb",
 | 
					            "blue_rom_file": "Pokemon Blue (UE) [S][!].gb",
 | 
				
			||||||
            "rom_start": True
 | 
					            "rom_start": True
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "ffr_options": {
 | 
				
			||||||
 | 
					            "display_msgs": True,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return options
 | 
					    return options
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,25 @@
 | 
				
			||||||
 | 
					import unittest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import Utils
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class TestIDs(unittest.TestCase):
 | 
				
			||||||
 | 
					    @classmethod
 | 
				
			||||||
 | 
					    def setUpClass(cls) -> None:
 | 
				
			||||||
 | 
					        with open(Utils.local_path("host.yaml")) as f:
 | 
				
			||||||
 | 
					            cls.yaml_options = Utils.parse_yaml(f.read())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def testUtilsHasHost(self):
 | 
				
			||||||
 | 
					        for option_key, option_set in Utils.get_default_options().items():
 | 
				
			||||||
 | 
					            with self.subTest(option_key):
 | 
				
			||||||
 | 
					                self.assertIn(option_key, self.yaml_options)
 | 
				
			||||||
 | 
					                for sub_option_key in option_set:
 | 
				
			||||||
 | 
					                    self.assertIn(sub_option_key, self.yaml_options[option_key])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def testHostHasUtils(self):
 | 
				
			||||||
 | 
					        utils_options = Utils.get_default_options()
 | 
				
			||||||
 | 
					        for option_key, option_set in self.yaml_options.items():
 | 
				
			||||||
 | 
					            with self.subTest(option_key):
 | 
				
			||||||
 | 
					                self.assertIn(option_key, utils_options)
 | 
				
			||||||
 | 
					                for sub_option_key in option_set:
 | 
				
			||||||
 | 
					                    self.assertIn(sub_option_key, utils_options[option_key])
 | 
				
			||||||
| 
						 | 
					@ -7,8 +7,9 @@ from worlds.AutoWorld import AutoWorldRegister
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestDocs(unittest.TestCase):
 | 
					class TestDocs(unittest.TestCase):
 | 
				
			||||||
    def setUp(self) -> None:
 | 
					    @classmethod
 | 
				
			||||||
        self.tutorials_data = WebHost.create_ordered_tutorials_file()
 | 
					    def setUpClass(cls) -> None:
 | 
				
			||||||
 | 
					        cls.tutorials_data = WebHost.create_ordered_tutorials_file()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def testHasTutorial(self):
 | 
					    def testHasTutorial(self):
 | 
				
			||||||
        games_with_tutorial = set(entry["gameTitle"] for entry in self.tutorials_data)
 | 
					        games_with_tutorial = set(entry["gameTitle"] for entry in self.tutorials_data)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,10 +7,11 @@ import WebHost
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestFileGeneration(unittest.TestCase):
 | 
					class TestFileGeneration(unittest.TestCase):
 | 
				
			||||||
    def setUp(self) -> None:
 | 
					    @classmethod
 | 
				
			||||||
        self.correct_path = os.path.join(os.path.dirname(WebHost.__file__), "WebHostLib")
 | 
					    def setUpClass(cls) -> None:
 | 
				
			||||||
 | 
					        cls.correct_path = os.path.join(os.path.dirname(WebHost.__file__), "WebHostLib")
 | 
				
			||||||
        # should not create the folder *here*
 | 
					        # should not create the folder *here*
 | 
				
			||||||
        self.incorrect_path = os.path.join(os.path.split(os.path.dirname(__file__))[0], "WebHostLib")
 | 
					        cls.incorrect_path = os.path.join(os.path.split(os.path.dirname(__file__))[0], "WebHostLib")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def testOptions(self):
 | 
					    def testOptions(self):
 | 
				
			||||||
        WebHost.create_options_files()
 | 
					        WebHost.create_options_files()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue