tests: implement test to check for game_info file (#531)
This commit is contained in:
		
							parent
							
								
									551cf8442f
								
							
						
					
					
						commit
						c93eeb3607
					
				| 
						 | 
				
			
			@ -1,12 +1,17 @@
 | 
			
		|||
import unittest
 | 
			
		||||
import Utils
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
import WebHost
 | 
			
		||||
from worlds.AutoWorld import AutoWorldRegister
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TestTutorial(unittest.TestCase):
 | 
			
		||||
class TestDocs(unittest.TestCase):
 | 
			
		||||
    def setUp(self) -> None:
 | 
			
		||||
        self.tutorials_data = WebHost.create_ordered_tutorials_file()
 | 
			
		||||
 | 
			
		||||
    def testHasTutorial(self):
 | 
			
		||||
        import WebHost
 | 
			
		||||
        tutorials_data = WebHost.create_ordered_tutorials_file()
 | 
			
		||||
        games_with_tutorial = set(entry["gameTitle"] for entry in tutorials_data)
 | 
			
		||||
        games_with_tutorial = set(entry["gameTitle"] for entry in self.tutorials_data)
 | 
			
		||||
        for game_name, world_type in AutoWorldRegister.world_types.items():
 | 
			
		||||
            if not world_type.hidden:
 | 
			
		||||
                with self.subTest(game_name):
 | 
			
		||||
| 
						 | 
				
			
			@ -20,3 +25,14 @@ class TestTutorial(unittest.TestCase):
 | 
			
		|||
                        else:
 | 
			
		||||
                            self.fail(f"{game_name} has no setup tutorial. "
 | 
			
		||||
                                      f"Games with Tutorial: {games_with_tutorial}")
 | 
			
		||||
 | 
			
		||||
    def testHasGameInfo(self):
 | 
			
		||||
        for game_name, world_type in AutoWorldRegister.world_types.items():
 | 
			
		||||
            if not world_type.hidden:
 | 
			
		||||
                target_path = Utils.local_path("WebHostLib", "static", "generated", "docs", game_name)
 | 
			
		||||
                for game_info_lang in world_type.web.game_info_languages:
 | 
			
		||||
                    with self.subTest(game_name):
 | 
			
		||||
                        self.assertTrue(
 | 
			
		||||
                            os.path.isfile(Utils.local_path(target_path, f'{game_info_lang}_{game_name}.md')),
 | 
			
		||||
                            f'{game_name} missing game info file for "{game_info_lang}" language.'
 | 
			
		||||
                        )
 | 
			
		||||
		Loading…
	
		Reference in New Issue