-
Notifications
You must be signed in to change notification settings - Fork 0
/
signin.py
40 lines (29 loc) · 1.16 KB
/
signin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from generalgui import Page, Label, Entry, Password, Button
class SigninPage(Page):
""" General sign in Page. """
client = ...
def __init__(self, parent=None):
self.label = Label(self, "Welcome")
self.email = Entry(self)
self.password = Password(self, hidden=True)
self.email.text = "tests@gmail.com"
self.password.text = "hellothere"
buttons = Page(self)
self.button_signin = Button(buttons, "Sign in", self.signin)
self.button_register = Button(buttons, "Register", self.register)
def hook_signin_success(self, response): ...
def signin(self):
email = self.email.text
password = self.password.text
response = self.client.signin(email=email, password=password)
if response.status_code == 200:
self.hook_signin_success(response=response)
else:
self.label.text = response.text
return response
def register(self):
email = self.email.text
password = self.password.text
response = self.client.register(email=email, password=password)
self.label.text = response.text
return response