def test_api_proxy(self): api = PicovicoAPI("app_id", "device_id") assert api.app_id assert api.headers is None api.set_access_tokens("access_key", "access_token") assert api.headers assert api.is_authorized() api.logout() assert not api.is_authorized()
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()