def test_create_delete_session(self): device_id = '123-231-321' SqlCommands.insert_new_session(3, device_id) sessions = DatabaseConnection().fetch_query('select * from session where 1') self.assertTrue(len(sessions) == 1) SqlCommands.delete_session(device_id) sessions = DatabaseConnection().fetch_query('select * from session where 1') self.assertTrue(len(sessions) == 0)
def perform_callback(self, instance, *args, **kwargs): if App.get_running_app().root.logged_user is None: try: imie, nazwisko, id, uprawnienia = self.database_query.result() # App.get_running_app().root.logged_user = User(name=imie, user_id=id, # permission=uprawnienia, lastname=nazwisko) # App.get_running_app().root.choosen_user = App.get_running_app().root.logged_user SqlCommands.insert_new_session(id, plyer.uniqueid.id) Clock.schedule_once(lambda a: instance.check_device_session()) except: Clock.schedule_once(instance.wrong_login)