def register_service(self, password=None): username = checklib.rnd_username() if not password: password = checklib.rnd_password() r = requests.get(f'{self.url}/registerForm', params={ 'login': username, 'password': password }) checklib.check_response(r, 'Could not register') return username, password
def get_last_users(self): r = requests.get(f'{self.url}/lastusers') checklib.check_response(r, 'Could not get last users') return checklib.get_text(r, 'Could not get last users')
def get_add_page(self, sess): r = sess.get(f'{self.url}/add.html') checklib.check_response(r, 'Could not get add icecream page') return checklib.get_text(r, 'Could not get add icecream page')
def get_register_page(self): r = requests.get(f'{self.url}/register.html') checklib.check_response(r, 'Could not get register page') return checklib.get_text(r, 'Could not get register page')
def get_login_page(self): r = requests.get(f'{self.url}/login.html') checklib.check_response(r, 'Could not get login page') return checklib.get_text(r, 'Could not get login page')
def get_index(self): r = requests.get(f'{self.url}/') checklib.check_response(r, 'Could not get main page') return checklib.get_text(r, 'Could not get main page')
def get_my_icecreams(self, session): my_url = f'{self.url}/icecreams' r = session.get(url=my_url) checklib.check_response(r, 'Could not get user icecreams') return checklib.get_text(r, 'Could not get user icecreams')
def add_icecream(self, session, text): add_url = f'{self.url}/addForm' r = session.get(url=add_url, params={'icecream': text}) checklib.check_response(r, 'Could not add icecream') return checklib.get_text(r, 'Could not add icecream')