Esempio n. 1
0
class TestAuth:
    def __init__(self):
        self.auth = None

    def setup(self):
        """ Execute for every test case """
        self.auth = Auth(mysession)

    def test_get_token(self):
        """ Testing the token request """
        self.auth = Auth()
        token = self.auth.get_token()
        assert_true(isinstance(token, basestring))
        assert_equal(len(token), 32)

    def test_signature_generation(self):
        """ Testing the signature generation from Auth class """
        data = {"method": "falsemethodfortest", "limit": "10"}
        signature = self.auth.sign(data)
        assert_true(isinstance(signature, basestring))
        assert_equal(len(signature), 32)

    def test_get_user_session(self):
        """ Testing the user session request """
        session = self.auth.get_session()
        assert_true(isinstance(session, basestring))
        assert_equal(len(session), 32)
Esempio n. 2
0
class TestAuth():
    def __init__(self):
        self.auth = None

    def setup(self):
        """ Execute for every test case """
        self.auth = Auth(mysession)

    def test_get_token(self):
        """ Testing the token request """
        self.auth = Auth()
        token = self.auth.get_token()
        assert_true(isinstance(token, basestring))
        assert_equal(len(token), 32)

    def test_signature_generation(self):
        """ Testing the signature generation from Auth class """
        data = {'method': "falsemethodfortest", 'limit': "10"}
        signature = self.auth.sign(data)
        assert_true(isinstance(signature, basestring))
        assert_equal(len(signature), 32)

    def test_get_user_session(self):
        """ Testing the user session request """
        session = self.auth.get_session()
        assert_true(isinstance(session, basestring))
        assert_equal(len(session), 32)
Esempio n. 3
0
 def test_share(self):
     """ Testing Event share """
     auth = Auth(mysession)
     message = "testing api event share"
     share = self.event.share(public=False, message=message,
                              recipient="lastfm", auth=auth)
     self.utils.assert_response_content(share)
Esempio n. 4
0
 def test_remove_tags(self):
     """ Testing Artist add tags """
     tag = u'test api'
     auth = Auth(mysession)
     tags = self.artist.remove_tag(tag=tag, auth=auth)
     self.utils.assert_response_content(tags)
     assert_equal(tags['status'], 'ok')
Esempio n. 5
0
 def test_add_tags(self):
     """ Testing Artist add tags """
     tag = u'test api'
     auth = Auth(mysession)
     tags = self.artist.add_tags(tags=tag, auth=auth)
     self.utils.assert_response_content(tags)
     assert_equal(tags['status'], 'ok')
     tags = self.artist.get_tags(auth=auth)
     assert_equal(tags['tags']['tag']['name'], tag)
Esempio n. 6
0
    def test_share(self):
        """ Testing Album share """
        auth = Auth(mysession)
        share = self.album.share(recipient="lastfm",
                                 message="api test",
                                 public=True,
                                 auth=auth)

        self.utils.assert_response_content(share)
        assert_equal(share['status'], 'ok')
Esempio n. 7
0
 def test_remove_tag(self):
     """ Testing Album remove tag """
     auth = Auth(mysession)
     tag = self.album.remove_tag(tag="api test", auth=auth)
     self.utils.assert_response_content(tag)
Esempio n. 8
0
 def test_shout(self):
     """ Testing Event shout """
     auth = Auth(mysession)
     message = "More one api test"
     shout = self.event.shout(message=message, auth=auth)
     self.utils.assert_response_content(shout)
Esempio n. 9
0
 def test_attend(self):
     """ Testing Event attend """
     auth = Auth(mysession)
     event = self.event.attend(status=Event.ATTENDING, auth=auth)
     self.utils.assert_response_content(event)
Esempio n. 10
0
 def test_post_shout(self):
     """ Testing Artist shout """
     auth = Auth(mysession)
     shout = self.artist.shout(message="nice Indie rock band", auth=auth)
     self.utils.assert_response_content(shout)
     assert_equal(shout['status'], 'ok')
Esempio n. 11
0
 def test_get_token(self):
     """ Testing the token request """
     self.auth = Auth()
     token = self.auth.get_token()
     assert_true(isinstance(token, basestring))
     assert_equal(len(token), 32)
Esempio n. 12
0
 def test_tags_no_user(self):
     """ Testing Artist tags with no user """
     auth = Auth(mysession)
     tags = self.artist.get_tags(auth=auth)
     self.utils.assert_response_content(tags)
Esempio n. 13
0
 def test_get_token(self):
     """ Testing the token request """
     self.auth = Auth()
     token = self.auth.get_token()
     assert_true(isinstance(token, basestring))
     assert_equal(len(token), 32)
Esempio n. 14
0
 def setup(self):
     """ Execute for every test case """
     self.auth = Auth(mysession)
Esempio n. 15
0
    def setup(self):

        self.artist = Artist("Foo fighters")
        self.auth = Auth(mysession)
        self.album = Album(artist=self.artist, album="Wasting Light")
        self.utils = Utils()
Esempio n. 16
0
 def test_get_tags(self):
     """ Testing Album tags """
     auth = Auth(mysession)
     tags = self.album.get_tags(auth=auth)
     self.utils.assert_response_content(tags)
     assert_in("name", tags['tags']['tag'])
Esempio n. 17
0
 def setup(self):
     """ Execute for every test case """
     self.auth = Auth(mysession)