mirror of
				https://github.com/KevinMidboe/spotify-downloader.git
				synced 2025-10-29 18:00:15 +00:00 
			
		
		
		
	Increase coverage (#218)
* Monkeypatch fetch user and use pytest.tempdir * Cover spotify_tools.grab_album() * Cover avconv conversion * Cover grab_single() * Reduce code repetition * Move grab_playlist() to spotify_tools.py * Move Spotify specific functions to spotify_tools.py * Refactoring * Return track list from write_tracks() * Fix tests * Cover more cases in generate_youtube_url() * Test for unavailable audio streams * Test for filename without spaces * handle.py 100% coverage * Improve config tests * Speed up tests * Install avconv and libfdk-aac * Some cleaning * FFmpeg with libfdk-aac, libopus * Some refactoring * Convert tmpdir to string * Cover YouTube title when downloading from list * Explicitly cover some internals.py functions
This commit is contained in:
		
							
								
								
									
										38
									
								
								test/test_internals.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								test/test_internals.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| from core import internals | ||||
|  | ||||
| import os | ||||
|  | ||||
|  | ||||
| class TestPathFilterer: | ||||
|     def test_create_directory(self, tmpdir): | ||||
|         expect_path = True | ||||
|         global folder_path | ||||
|         folder_path = os.path.join(str(tmpdir), 'filter_this_folder') | ||||
|         internals.filter_path(folder_path) | ||||
|         is_path = os.path.isdir(folder_path) | ||||
|         assert is_path == expect_path | ||||
|  | ||||
|     def test_remove_temp_files(self, tmpdir): | ||||
|         expect_file = False | ||||
|         file_path = os.path.join(folder_path, 'pesky_file.temp') | ||||
|         open(file_path, 'a') | ||||
|         internals.filter_path(folder_path) | ||||
|         is_file = os.path.isfile(file_path) | ||||
|         assert is_file == expect_file | ||||
|  | ||||
|  | ||||
| class TestVideoTime: | ||||
|     def test_from_seconds(self): | ||||
|         expect_duration = '35' | ||||
|         duration = internals.videotime_from_seconds(35) | ||||
|         assert duration == expect_duration | ||||
|  | ||||
|     def test_from_minutes(self): | ||||
|         expect_duration = '2:38' | ||||
|         duration = internals.videotime_from_seconds(158) | ||||
|         assert duration == expect_duration | ||||
|  | ||||
|     def test_from_hours(self): | ||||
|         expect_duration = '1:16:02' | ||||
|         duration = internals.videotime_from_seconds(4562) | ||||
|         assert duration == expect_duration | ||||
		Reference in New Issue
	
	Block a user