Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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')
Ejemplo n.º 3
0
 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')
Ejemplo n.º 4
0
 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')
Ejemplo n.º 5
0
 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')
Ejemplo n.º 6
0
 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')
Ejemplo n.º 7
0
 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')
Ejemplo n.º 8
0
 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')