-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joel Lee
authored and
Joel Lee
committed
Jan 25, 2021
1 parent
dda60f3
commit eff88f3
Showing
2 changed files
with
29 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
import urllib | ||
import json | ||
|
||
HTTPRegexp = "/^http:\/\//" | ||
HTTPRegexp = "/^http://" | ||
defaultApiURL = "/.netlify/identity" | ||
|
||
|
||
|
@@ -27,37 +27,32 @@ def settings(self): | |
r = requests.get(f"{self.BASE_URL}/settings") | ||
return r | ||
|
||
def sign_up(credentials): | ||
data = json.dumps({ | ||
"email": "[email protected]", | ||
"password": "yadayada" | ||
}) | ||
requests.post(f"{self.BASE_URL}/signup", data) | ||
def sign_up(credentials: dict): | ||
requests.post(f"{self.BASE_URL}/signup", credentials) | ||
|
||
def login(): | ||
pass | ||
|
||
def login_external_url(provider): | ||
pass | ||
|
||
def confirm(token, remember): | ||
pass | ||
def logout(jwt: str): | ||
# TODO: Validate how to send jwt | ||
requests.post(f"{self.BASE_URL}/logout", jwt) | ||
|
||
def request_password_recovery(email): | ||
def confirm(self, token, remember): | ||
pass | ||
|
||
def recover(token, remember): | ||
def recover(self, email: str): | ||
""" Send a recovery email """ | ||
pass | ||
|
||
def accept_invite(token, password, remember): | ||
pass | ||
data = json.dumps({"email": email}) | ||
return requests.post(f"{self.BASE_URL}/recover", data) | ||
|
||
def acceptInviteUrl(provider, token): | ||
def accept_invite(self, token, password, remember): | ||
pass | ||
|
||
def get_user(): | ||
pass | ||
requests.get(f"{self.BASE_URL}/user", jwt) | ||
|
||
def update_user(): | ||
pass | ||
|
@@ -74,15 +69,18 @@ def send_magic_link(self, email: str): | |
data = json.dumps({"email": email}) | ||
return requests.post(f"{self.BASE_URL}/magiclink", data=data) | ||
|
||
def invite(self, invitation): | ||
"""Invite a new user to join""" | ||
return requests.post(f"{self.BASE_URL}/invite", invitation) | ||
|
||
def grant_token(type, payload): | ||
payload = json.dumps({ | ||
"email": "[email protected]", | ||
"password": "yadayada" | ||
}) | ||
headers = {'Content-Type': 'application/x-www-form-urlencoded'} | ||
requests.post( | ||
"https://distracted-elion-6bf6a2.netlify.app/.netlify/identity/verify", | ||
data=json.dumps({ | ||
"type": "signup", | ||
"token": "tokenthing" | ||
})) | ||
requests.post(f"{self.BASE_URL}/verify", | ||
data=json.dumps({ | ||
"type": "signup", | ||
"token": "tokenthing" | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,15 +23,20 @@ def test_signup(client): | |
pass | ||
|
||
def test_login(client): | ||
assert 1 | ||
pass | ||
|
||
def test_verify(client): | ||
assert 1 | ||
pass | ||
|
||
def test_logout(self): | ||
pass | ||
|
||
|
||
def test_send_magic_link(client): | ||
res = client.send_magic_link("[email protected]") | ||
res = client.send_magic_link("[email protected]") | ||
assert (res.status_code == 200 or res.status_code == 429) | ||
|
||
|
||
def test_recover_email(client): | ||
res = client.recover("[email protected]") | ||
assert (res.status_code == 200 or res.status_code == 429) |