def test_valid_registration(client): email = "*****@*****.**" password = "******" response = client.post("/api/user/register/", json={ "email": email, "password": password }) res = response.get_json() assert 200 == response.status_code assert res['success'] assert res['auth_token'] User.delete_by_email(email=email)
from backend.users.models import User, HistoryItem from backend.podcasts.models import Podcast from backend.search.models import PodcastTranscriptionBlob # Fresh test user test_user1_email = "*****@*****.**" test_user1_pass = "******" # Populated test user test_user2_email = "*****@*****.**" test_user2_pass = "******" # Delete any existing test users print("Deleting any existing test users...") User.delete_by_email(test_user1_email) User.delete_by_email(test_user2_email) time.sleep(2) # Register these 2 test users print("Registering 2 test users...") test_user1 = User.register_new_user(email=test_user1_email, password=test_user1_pass) test_user2 = User.register_new_user(email=test_user2_email, password=test_user2_pass) random_transcription_blobs = [ transcription_blob for transcription_blob in PodcastTranscriptionBlob.search().query( "match_all").extra(collapse={"field": "podcast_id"})[:20]