Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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')
Exemple #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)
Exemple #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')
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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')
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #14
0
 def setup(self):
     """ Execute for every test case """
     self.auth = Auth(mysession)
Exemple #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()
Exemple #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'])
Exemple #17
0
 def setup(self):
     """ Execute for every test case """
     self.auth = Auth(mysession)