def test_login_authenticate(self, pv_mocks, pv_response):
     request_mock = pv_mocks.REQUEST
     request_mock.return_value = pv_response.SUCCESS.AUTH
     api = PicovicoAPI("app_id", "device_id")
     assert not api.is_authorized()
     api.login("username", "password")
     assert api.is_authorized()
     api = PicovicoAPI("app_id", "device_id")
     assert not api.is_authorized()
     api.authenticate("app_secret")
     assert api.is_authorized()
 def test_auth_decoration(self, pv_mocks, pv_response, pv_act_request_args, pv_urls):
     request_mock = pv_mocks.REQUEST
     calls = ("app_id", "device_id", "username", "password")
     api = PicovicoAPI(*calls[:2])
     post_call = pv_act_request_args.POST.copy()
     with pytest.raises(pv_exceptions.PicovicoAPINotAllowed):
         api.me()
     request_mock.return_value = pv_response.SUCCESS.AUTH
     api.login(*calls[2:])
     post_call.update(data=dict(zip(calls, calls)), url=pv_urls.PICOVICO_LOGIN)
     request_mock.assert_called_with(**post_call)
     api.me()
     me_call = pv_act_request_args.GET_AUTH.copy()
     me_call.update(url=pv_urls.ME)
     request_mock.assert_called_with(**me_call)
#'YOUR-APP-SECRET'

#initiate api
api = PicovicoAPI(PICOVICO_APP_ID, PICOVICO_DEVICE_ID, PICOVICO_APP_SECRET)
#api = PicovicoAPI(PICOVICO_APP_ID, PICOVICO_DEVICE_ID)

#to get picovico system components
free_styles = api.free_styles()
free_musics = api.free_musics()

#To authenticate
api.authenticate('YOUR-APP-SECRET')
#if secret is initiated in api just call api.authenticate()

#To login with username and password
api.login('YOUR-USERNAME', 'YOUR-PASSWORD')

#Either login or authenticate is needed for actions described below:
my_music_component = api.music_component
my_style_component = api.style_component
my_photo_component = api.photo_component
my_video_component = api.video_component

#View profile 
api.me()

#All components are provided with some basic method
#In some cases the method may not be implemented
#Component methods
my_photo_component.all()
my_photo_component.one('SINGLE_PHOTO_ID')