コード例 #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
コード例 #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')
コード例 #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')
コード例 #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')
コード例 #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')
コード例 #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')
コード例 #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')
コード例 #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')