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)
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)
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)
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')
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)
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')
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)
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)
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)
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')
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_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)
def setup(self): """ Execute for every test case """ self.auth = Auth(mysession)
def setup(self): self.artist = Artist("Foo fighters") self.auth = Auth(mysession) self.album = Album(artist=self.artist, album="Wasting Light") self.utils = Utils()
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'])