This repository has been archived by the owner on Aug 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from quintindunn/development
Added hashed_phone_number to Profile class.
- Loading branch information
Showing
12 changed files
with
272 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import os | ||
|
||
from lapsepy.lapse import Lapse | ||
|
||
if __name__ == '__main__': | ||
lapse = Lapse(os.getenv("REFRESH_TOKEN")) | ||
|
||
current_user = lapse.get_current_user() | ||
|
||
print(current_user) |
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
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
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
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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import os | ||
import time | ||
import uuid | ||
|
||
from lapsepy import Lapse | ||
|
||
from unittest import TestCase | ||
|
||
lapse = Lapse(os.getenv("LAPSE-TEST-REFRESH")) | ||
|
||
test_lapse_profile = lapse.get_current_user() | ||
|
||
|
||
thought_id = None | ||
|
||
|
||
class TestFeeds(TestCase): | ||
def test_create_thought_generic(self): | ||
global thought_id | ||
|
||
if thought_id is None: | ||
thought_id = f"STATUS_UPDATE:{uuid.uuid4()}" | ||
lapse.create_status_update("This is my generic test for thoughts.", msg_id=thought_id) | ||
|
||
def test_create_thought_long(self): | ||
lapse.create_status_update("This is a test for long thoughts, thoughts on Lapse are not supposed to be able to " | ||
"to pass 90 characters, however through sending them directly from the API this can" | ||
"be avoided as of 11/8/2023, not that you care, I just needed something to write for" | ||
"this test...") | ||
|
||
def test_delete_thought(self): | ||
msg_id = f"STATUS_UPDATE:{uuid.uuid4()}" | ||
lapse.create_status_update("This is a thought that will be deleted.", msg_id=msg_id) | ||
time.sleep(5) # Let the status update reach Lapse servers. | ||
lapse.remove_status_update(msg_id=msg_id) | ||
|
||
def test_react_thought_generic(self): | ||
global thought_id | ||
|
||
if thought_id is None: | ||
thought_id = f"STATUS_UPDATE:{uuid.uuid4()}" | ||
lapse.create_status_update("This is my generic test for thoughts.", msg_id=thought_id) | ||
|
||
lapse.add_reaction(thought_id, "😀") | ||
|
||
def test_react_thought_multiple(self): | ||
global thought_id | ||
|
||
if thought_id is None: | ||
thought_id = f"STATUS_UPDATE:{uuid.uuid4()}" | ||
lapse.create_status_update("This is my generic test for thoughts.", msg_id=thought_id) | ||
|
||
for _ in range(5): | ||
lapse.add_reaction(thought_id, "😄") | ||
|
||
def test_react_thought_text(self): | ||
global thought_id | ||
|
||
if thought_id is None: | ||
thought_id = f"STATUS_UPDATE:{uuid.uuid4()}" | ||
lapse.create_status_update("This is my generic test for thoughts.", msg_id=thought_id) | ||
|
||
lapse.add_reaction(thought_id, "does this work?") | ||
|
||
def test_remove_reaction(self): | ||
global thought_id | ||
|
||
if thought_id is None: | ||
thought_id = f"STATUS_UPDATE:{uuid.uuid4()}" | ||
lapse.create_status_update("This is my generic test for thoughts.", msg_id=thought_id) | ||
|
||
lapse.add_reaction(thought_id, "😆") | ||
time.sleep(2.5) # Give reaction time for Lapse server to receive reaction | ||
lapse.remove_reaction(thought_id, "😆") |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os | ||
|
||
from lapsepy import Lapse | ||
|
||
from unittest import TestCase | ||
|
||
lapse = Lapse(os.getenv("LAPSE-TEST-REFRESH")) | ||
|
||
test_lapse_profile = lapse.get_current_user() | ||
|
||
|
||
class TestFetching(TestCase): | ||
def test_current_user(self): | ||
lapse.get_current_user() | ||
|
||
def test_get_profile_by_id(self): | ||
user_id = test_lapse_profile.user_id | ||
|
||
user_profile = lapse.get_profile_by_id(user_id=user_id) | ||
|
||
assert user_profile.username == test_lapse_profile.username | ||
|
||
def test_fetch_profile_image(self): | ||
test_lapse_profile.load_profile_picture(quality=100, height=200) |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import os | ||
|
||
from lapsepy import Lapse | ||
|
||
from unittest import TestCase | ||
|
||
lapse = Lapse(os.getenv("LAPSE-TEST-REFRESH")) | ||
|
||
|
||
class TestDOB(TestCase): | ||
def test_modify_dob_year_greater_than_current(self): | ||
lapse.update_dob("9999-01-01") | ||
|
||
def test_modify_dob_younger_than_thirteen(self): | ||
lapse.update_dob("2023-01-01") | ||
|
||
def test_modify_dob_generic(self): | ||
lapse.update_dob("2005-05-05") | ||
|
||
|
||
class TestUsername(TestCase): | ||
def test_modify_username_generic(self): | ||
lapse.update_username("quintinbot") | ||
|
||
|
||
class TestBio(TestCase): | ||
def test_bio_generic(self): | ||
lapse.update_bio("Hello, this bio is an automated test using Lapsepy (https://github.com/quintindunn/lapsepy)") | ||
|
||
|
||
class TestDisplayName(TestCase): | ||
def test_display_name_generic(self): | ||
lapse.update_display_name("Automated DisplayName") | ||
|
||
def test_display_name_long(self): | ||
lapse.update_display_name( | ||
"Hello, this bio is another step in of the automated test for my project Lapsepy, more " | ||
"information on this project can be found on my Github profile, at " | ||
"https://github.com/quintindunn/lapsepy, if you have any questions feel free to reach out " | ||
"to me") | ||
|
||
|
||
class TestEmojis(TestCase): | ||
def test_emojis_generic(self): | ||
lapse.update_emojis(["😀", "😃", "😄", "😁", "😆"]) | ||
|
||
def test_emojis_n_amount(self): | ||
content = "😀😃😄😁😆" | ||
for i in range(1, 6): | ||
lapse.update_emojis(list(content[:i])) | ||
|
||
def test_emojis_text(self): | ||
lapse.update_emojis(["This is a test", "This is also part of the test", "This too", "And this", "Me too!"]) |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import os | ||
import time | ||
import uuid | ||
|
||
from PIL import Image | ||
|
||
from lapsepy import Lapse | ||
|
||
from unittest import TestCase | ||
|
||
lapse = Lapse(os.getenv("LAPSE-TEST-REFRESH")) | ||
|
||
test_lapse_profile = lapse.get_current_user() | ||
|
||
example_im = Image.open("./assets/example_1.jpg") | ||
|
||
|
||
im_uuid = None | ||
|
||
|
||
class TestUploading(TestCase): | ||
def test_upload(self): | ||
global im_uuid | ||
|
||
if im_uuid is None: | ||
im_uuid = "01HDBZ" + str(uuid.uuid4()).upper().replace("-", "")[:20] | ||
lapse.upload_photo(im=example_im, develop_in=15, file_uuid=im_uuid) | ||
|
||
def test_darkroom_query(self): | ||
global im_uuid | ||
|
||
if im_uuid is None: | ||
im_uuid = "01HDBZ" + str(uuid.uuid4()).upper().replace("-", "")[:20] | ||
lapse.upload_photo(im=example_im, develop_in=15, file_uuid=im_uuid) | ||
time.sleep(2.5) # Wait for lapse servers to process image. | ||
|
||
lapse.query_darkroom() | ||
|
||
def test_review(self): | ||
def generate_drm(): | ||
drm_id = "01HDBZ" + str(uuid.uuid4()).upper().replace("-", "")[:20] | ||
lapse.upload_photo(im=example_im, develop_in=15, file_uuid=drm_id) | ||
time.sleep(2.5) # Wait for lapse servers to process image. | ||
return drm_id | ||
|
||
[generate_drm() for _ in range(3)] | ||
|
||
drm = list(lapse.query_darkroom()) | ||
|
||
drm[0].archive(lapse) | ||
drm[1].delete(lapse) | ||
drm[2].share(lapse) | ||
|
||
def test_upload_instant(self): | ||
test_lapse_profile.send_instant(ctx=lapse, im=example_im, caption="Automated test") |