<commit_before>from __future__ import unicode_literals

import unittest
from mopidy.models import Track
from mopidy_soundcloud import SoundCloudExtension

from mopidy_soundcloud.soundcloud import SoundCloudClient


class ApiTest(unittest.TestCase):

    def setUp(self):
        config = SoundCloudExtension().get_config_schema()
        config['auth_token'] = '<PASSWORD>'
        # using this user http://maildrop.cc/inbox/mopidytestuser
        self.api = SoundCloudClient(config)

    def test_resolves_string(self):
        id = self.api.parse_track_uri('soundcloud:song.38720262')
        self.assertEquals(id, '38720262')

    def test_resolves_object(self):

        trackc = {}
        trackc[b'uri'] = 'soundcloud:song.38720262'
        track = Track(**trackc)

        id = self.api.parse_track_uri(track)
        self.assertEquals(id, '38720262')

    def test_resolves_emptyTrack(self):

        track = self.api.get_track('s38720262')
        self.assertIsInstance(track, Track)
        self.assertEquals(track.uri, None)

    def test_resolves_Track(self):

        track = self.api.get_track('38720262')
        self.assertIsInstance(track, Track)
        self.assertEquals(
            track.uri,
            'soundcloud:song/Burial Four Tet - Nova.38720262'
        )

    def test_resolves_http_url(self):

        track = self.api.resolve_url(
            'https://soundcloud.com/swedensfinestmusicblog/'
            'robert-parker-brooklyn-brigde'
        )[0]
        self.assertIsInstance(track, Track)
        self.assertEquals(
            track.uri,
            'soundcloud:song/<NAME>er - Brooklyn Brigde.135101951'
        )

    def test_get_user_liked(self):

        tracks = self.api.get_user_liked()
        self.assertIsInstance(tracks, list)

    def test_get_user_stream(self):

        tracks = self.api.get_user_stream()
        self.assertIsInstance(tracks, list)

    def test_get_explore(self):

        tracks = self.api.get_explore()
        self.assertIsInstance(tracks, list)
        self.assertEquals(tracks[0], 'Popular+Music')

    def test_get_explore_popular_music(self):

        tracks = self.api.get_explore('1')
        self.assertIsInstance(tracks, list)
        self.assertIsInstance(tracks[0], Track)

    def test_get_followings(self):

        tracks = self.api.get_followings()
        self.assertIsInstance(tracks, list)

    def test_get_sets(self):
<commit_msg>Fix: Resolving test, link was invalid<commit_after>from __future__ import unicode_literals

import unittest
from mopidy.models import Track
from mopidy_soundcloud import SoundCloudExtension

from mopidy_soundcloud.soundcloud import SoundCloudClient


class ApiTest(unittest.TestCase):

    def setUp(self):
        config = SoundCloudExtension().get_config_schema()
        config['auth_token'] = '<PASSWORD>'
        # using this user http://maildrop.cc/inbox/mopidytestuser
        self.api = SoundCloudClient(config)

    def test_resolves_string(self):
        id = self.api.parse_track_uri('soundcloud:song.38720262')
        self.assertEquals(id, '38720262')

    def test_resolves_object(self):

        trackc = {}
        trackc[b'uri'] = 'soundcloud:song.38720262'
        track = Track(**trackc)

        id = self.api.parse_track_uri(track)
        self.assertEquals(id, '38720262')

    def test_resolves_emptyTrack(self):

        track = self.api.get_track('s38720262')
        self.assertIsInstance(track, Track)
        self.assertEquals(track.uri, None)

    def test_resolves_Track(self):

        track = self.api.get_track('38720262')
        self.assertIsInstance(track, Track)
        self.assertEquals(
            track.uri,
            'soundcloud:song/Burial Four Tet - Nova.38720262'
        )

    def test_resolves_http_url(self):

        track = self.api.resolve_url(
            'https://soundcloud.com/bbc-radio-4/m-w-cloud'
        )[0]
        self.assertIsInstance(track, Track)
        self.assertEquals(
            track.uri,
            'soundcloud:song/That Mitchell and Webb Sound The Cloud.122889665'
        )

    def test_get_user_liked(self):

        tracks = self.api.get_user_liked()
        self.assertIsInstance(tracks, list)

    def test_get_user_stream(self):

        tracks = self.api.get_user_stream()
        self.assertIsInstance(tracks, list)

    def test_get_explore(self):

        tracks = self.api.get_explore()
        self.assertIsInstance(tracks, list)
        self.assertEquals(tracks[0], 'Popular+Music')

    def test_get_explore_popular_music(self):

        tracks = self.api.get_explore('1')
        self.assertIsInstance(tracks, list)
        self.assertIsInstance(tracks[0], Track)

    def test_get_followings(self):

        tracks = self.api.get_followings()
        self.assertIsInstance(tracks, list)

    def test_get_sets(self):

{'fraction_non_alphanumeric': 0.10334849111202976, 'fraction_numerical': 0.028730880529144274, 'mean_word_length': 2.8465818759936408, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7175341', 'n_tokens_mistral': 1648, 'n_tokens_neox': 1482, 'n_words': 246}