# 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
        return self

    def list(self, *args, **kwargs):
        if kwargs['q'] == 'existing song':
            with open('tests/youtube_dump.json') as f:
                self.result = json.loads(f.read())
        return self

    def execute(self):
        return self

    def get(self, *args, **kwargs):
        return self.result


class YoutubeTestCase(TestCase):
    @mock.patch('googleapiclient.discovery.Resource',
                side_effect=mocked_Resource)
    def test_get_song_id(self, Resource):
        song_id = youtube.get_song_id('existing song')
        self.assertEqual(song_id, 'OV5_LQArLa0')

    @mock.patch('googleapiclient.discovery.Resource',
                side_effect=mocked_Resource)
    def test_get_song_id_if_no_song_is_found(self, Resource):
        with self.assertRaises(RuntimeError):
            youtube.get_song_id('missing song')

    def test_download_song_with_unsupported_format(self):
        with self.assertRaises(ValueError):

# 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

        return self

    def list(self, *args, **kwargs):
        if kwargs['q'] == 'existing song':
            with open('tests/youtube_dump.json') as f:
                self.result = json.loads(f.read())
        return self

    def execute(self):
        return self

    def get(self, *args, **kwargs):
        return self.result


class YoutubeTestCase(TestCase):
    @mock.patch('googleapiclient.discovery.Resource',
                side_effect=mocked_Resource)
    def test_get_song_id(self, Resource):
        song_id = youtube.get_song_id('existing song')
        self.assertEqual(song_id, 'OV5_LQArLa0')

    @mock.patch('googleapiclient.discovery.Resource',
                side_effect=mocked_Resource)
    def test_get_song_id_if_no_song_is_found(self, Resource):
        with self.assertRaises(RuntimeError):
            youtube.get_song_id('missing song')

    def test_download_song_with_unsupported_format(self):
        with self.assertRaises(ValueError):

            youtube.download_song('song id', 'wav')