@@ -166,19 +166,28 @@ def test_code_in_branch_subdirectory_more_than_one(self):
166
166
167
167
def test_move_code_out_of_subdirectory (self ):
168
168
"""All files are moved out and the subdirectory is deleted"""
169
- self .mock_addon .url = "https://something.com/something_else/something"
170
- installer = AddonInstaller (self .mock_addon , [])
171
- with tempfile .TemporaryDirectory () as temp_dir :
172
- subdir = os .path .join (temp_dir , f"something-{ self .mock_addon .branch } " )
173
- os .mkdir (subdir )
174
- with open (os .path .join (subdir , "README.txt" ), "w" , encoding = "utf-8" ) as f :
175
- f .write ("# Test file for unit testing" )
176
- with open (os .path .join (subdir , "AnotherFile.txt" ), "w" , encoding = "utf-8" ) as f :
177
- f .write ("# Test file for unit testing" )
178
- installer ._move_code_out_of_subdirectory (temp_dir )
179
- self .assertTrue (os .path .isfile (os .path .join (temp_dir , "README.txt" )))
180
- self .assertTrue (os .path .isfile (os .path .join (temp_dir , "AnotherFile.txt" )))
181
- self .assertFalse (os .path .isdir (subdir ))
169
+ test_urls = [
170
+ "https://something.com/something_else/something" ,
171
+ "https://something.com/something_else/something.git" ,
172
+ "https://something.com/something_else/something/" ,
173
+ "https://something.com/something_else/something.git/" ,
174
+ ]
175
+ for url in test_urls :
176
+ with self .subTest (url = url ):
177
+ self .mock_addon .url = url
178
+ installer = AddonInstaller (self .mock_addon , [])
179
+ # TODO: Someday use a mock filesystem instead of a temp dir
180
+ with tempfile .TemporaryDirectory () as temp_dir :
181
+ subdir = os .path .join (temp_dir , f"something-{ self .mock_addon .branch } " )
182
+ os .mkdir (subdir )
183
+ with open (os .path .join (subdir , "README.txt" ), "w" , encoding = "utf-8" ) as f :
184
+ f .write ("# Test file for unit testing" )
185
+ with open (os .path .join (subdir , "AnotherFile.txt" ), "w" , encoding = "utf-8" ) as f :
186
+ f .write ("# Test file for unit testing" )
187
+ installer ._move_code_out_of_subdirectory (temp_dir )
188
+ self .assertTrue (os .path .isfile (os .path .join (temp_dir , "README.txt" )))
189
+ self .assertTrue (os .path .isfile (os .path .join (temp_dir , "AnotherFile.txt" )))
190
+ self .assertFalse (os .path .isdir (subdir ))
182
191
183
192
def test_install_by_git (self ):
184
193
"""Test using git to install. Depends on there being a local git
0 commit comments