def build(self): if UserStore.exists('current_user'): UserStore.delete('current_user') if UserStore.exists('friends_loaded'): UserStore.delete('friends_loaded') if UserStore.exists('curr_profile'): UserStore.delete('curr_profile') if UserStore.exists('curr_event'): UserStore.delete('curr_event') self.screens = {} # Empty screen list self.available_screens = sorted([ 'app_settings', 'change_password', 'create_event', 'eventfind', 'friends', 'match', 'match_profile', 'profile', 'report_event', 'report_user', 'view_event']) # Explicitly sets the available screens self.screen_names = self.available_screens curdir = dirname(__file__) self.available_screens = [join(curdir, 'data', 'screens', '{}.kv'.format(fn).lower()) for fn in self.available_screens] # Create a list of available screens from the kv files #self.go_screen(5) # goto match screen if UserStore.exists("user_info"): if UserStore.get('user_info')["token"] is not None: query = User_Requests.login({}, auth_token=UserStore.get('user_info')["token"]) if 'error' not in query: self.root.current = "main" self.go_screen(5) return self.root
def test_user_login_manual(self): with TestUser() as user: output = User_Requests.login({ 'Email': user._user_info['Email'], 'Password': user._user_info['Password'] }) print(output) self.assertIsNotNone(output)
def login_click(self): j = { "Email": self.uni_email.text, "Password": self.password.text} user_details = User_Requests.login(j) if 'error' not in user_details: UserStore.put( 'user_info', token=user_details["access_token"], id=user_details["data"]["User_ID"] ) App.get_running_app().root.current = "main" App.get_running_app().go_screen(5) else: Popup( title=user_details['error']['title'], content=Label( text=user_details['error']['description'] ), size_hint=(.8, .2) ).open()
def test_user_login_auto(self): with TestUser() as user: output = User_Requests.login({}, auth_token=user._resp['access_token']) print(output) self.assertIsNotNone(output)