# Path: gepify/providers/songs.py
# def get_song(song_name):
# def add_song_file(song_name, file, format):
# def has_song_format(song_name, format):
# def download_song(self, song_info, provider='youtube', format='mp3'):
# 
# Path: gepify/providers/playlists.py
# def get_playlist(service, playlist, format):
# def has_playlist(service, playlist, format):
# def checksum(tracks):
# def handle_error(playlist_cache_key):
# def create_zip_playlist(playlist, service, checksum, format='mp3'):
# def download_playlist(playlist, service, provider='youtube', format='mp3'):
# def clean_playlists():
# 
# Path: gepify/providers/youtube.py
# DEVELOPER_KEY = os.environ.get('YOUTUBE_DEVELOPER_KEY')
# YOUTUBE_API_SERVICE_NAME = 'youtube'
# YOUTUBE_API_VERSION = 'v3'
# def get_song_id(song_name):
# def download_song(id, format):
# 
# Path: gepify/providers/soundcloud.py
# SOUNDCLOUD_CLIENT_ID = os.environ.get('SOUNDCLOUD_CLIENT_ID')
# def get_song_id(song_name):
# def download_song(id, format):


from unittest import mock, TestCase
from gepify.providers import songs, playlists, youtube, soundcloud
from werkzeug.contrib.cache import SimpleCache
import json
import time
import os
        self.assertEqual(song['files'], {})

    def test_add_song_file_if_format_is_unsupported(self):
        with self.assertRaises(ValueError):
            songs.add_song_file('some song', 'some song.mp3', 'wav')

    def test_add_song_file(self):
        song = songs.get_song('some song')
        self.assertNotIn('mp3', song['files'])
        songs.add_song_file('some song', 'some song.mp3', 'mp3')
        song = songs.get_song('some song')
        self.assertEqual(song['files']['mp3'], 'some song.mp3')

    def test_has_song_format(self):
        self.assertFalse(songs.has_song_format('some song', 'mp3'))
        songs.add_song_file('some song', 'some song.mp3', 'mp3')
        self.assertTrue(songs.has_song_format('some song', 'mp3'))

    def test_has_song_format_if_song_is_being_downloaded(self):
        self.assertFalse(songs.has_song_format('some song', 'mp3'))
        song = songs.get_song('some song')
        song['files']['mp3'] = 'downloading'
        songs.cache.set('some song', song)
        self.assertFalse(songs.has_song_format('some song', 'mp3'))


class SongsTasksTestCase(TestCase):
    def setUp(self):
        songs.cache = SimpleCache()


# Path: gepify/providers/songs.py
# def get_song(song_name):
# def add_song_file(song_name, file, format):
# def has_song_format(song_name, format):
# def download_song(self, song_info, provider='youtube', format='mp3'):
# 
# Path: gepify/providers/playlists.py
# def get_playlist(service, playlist, format):
# def has_playlist(service, playlist, format):
# def checksum(tracks):
# def handle_error(playlist_cache_key):
# def create_zip_playlist(playlist, service, checksum, format='mp3'):
# def download_playlist(playlist, service, provider='youtube', format='mp3'):
# def clean_playlists():
# 
# Path: gepify/providers/youtube.py
# DEVELOPER_KEY = os.environ.get('YOUTUBE_DEVELOPER_KEY')
# YOUTUBE_API_SERVICE_NAME = 'youtube'
# YOUTUBE_API_VERSION = 'v3'
# def get_song_id(song_name):
# def download_song(id, format):
# 
# Path: gepify/providers/soundcloud.py
# SOUNDCLOUD_CLIENT_ID = os.environ.get('SOUNDCLOUD_CLIENT_ID')
# def get_song_id(song_name):
# def download_song(id, format):


# Path: tests/test_providers.py
from unittest import mock, TestCase
from gepify.providers import songs, playlists, youtube, soundcloud
from werkzeug.contrib.cache import SimpleCache
import json
import time
import os

        self.assertEqual(song['files'], {})

    def test_add_song_file_if_format_is_unsupported(self):
        with self.assertRaises(ValueError):
            songs.add_song_file('some song', 'some song.mp3', 'wav')

    def test_add_song_file(self):
        song = songs.get_song('some song')
        self.assertNotIn('mp3', song['files'])
        songs.add_song_file('some song', 'some song.mp3', 'mp3')
        song = songs.get_song('some song')
        self.assertEqual(song['files']['mp3'], 'some song.mp3')

    def test_has_song_format(self):
        self.assertFalse(songs.has_song_format('some song', 'mp3'))
        songs.add_song_file('some song', 'some song.mp3', 'mp3')
        self.assertTrue(songs.has_song_format('some song', 'mp3'))

    def test_has_song_format_if_song_is_being_downloaded(self):
        self.assertFalse(songs.has_song_format('some song', 'mp3'))
        song = songs.get_song('some song')
        song['files']['mp3'] = 'downloading'
        songs.cache.set('some song', song)
        self.assertFalse(songs.has_song_format('some song', 'mp3'))


class SongsTasksTestCase(TestCase):
    def setUp(self):
        songs.cache = SimpleCache()


    def test_download_song_in_unsupported_format(self):