def create_user(**kwargs): userE = user.create_user( uuid=kwargs.get('uuid', uuid.uuid4().hex), email=kwargs.get('email', fake.email()), password='******', enabled=True) return userE
def _load_users_fixtures(): create_user('*****@*****.**', 'abc12345', '8c99f50fcb424c66b6e489d15461b782') create_user('*****@*****.**', 'abc12345', '9942eb5913c54f2eae5353e6b43324fb') e = create_author("Ernest", "Hemingway", datetime.date(1899, 3, 20), datetime.date(1950, 6, 7)) d = create_author("Fjodor", "Dostoyevski", datetime.date(1800, 3, 30), datetime.date(1876, 1, 11)) bells = create_book(e, "To Whom the Bell Toll") man = create_book(e, "Man and the Sea") crime = create_book(d, "Crime and Punishment") gambler = create_book(d, "The Gambler") t, crime_tag = create_tag("crime") t, classic_tag = create_tag("classic") modify_book(bells.id, None, None, [crime_tag.id, classic_tag.id]) modify_book(man.id, None, None, [crime_tag.id, classic_tag.id]) modify_book(crime.id, None, None, [crime_tag.id, classic_tag.id]) modify_book(gambler.id, None, None, [crime_tag.id]) modify_book(gambler.id, None, None, [classic_tag.id])
def test_integration_like_artist_fail(): request = Request() # create user user = create_user('*****@*****.**', '1234', '8c99f50fcb424c66b6e489d15461b781') like_data = { 'user_id': user.id } request['body'] = like_data # execute controller = Like() result = controller.post(request, id=1) assert result['status'] == 400 assert "id" in result['body'] assert result['body']['id']['code'] == "ARTIST_ID_NOT_FOUND"
def test_integration_like_artist_ok(): request = Request() # create user user = create_user('*****@*****.**', '1234', '8c99f50fcb424c66b6e489d15461b781') like_data = { 'user_id': user.id } request['body'] = like_data # create artist artist_data = { 'name': 'Duke Ellington', 'biography': 'American composer, pianist and bandleader of a jazz orchestra.', } artist = create_artist(**artist_data) # execute controller = Like() result = controller.post(request, id=artist.id) assert result['status'] == 200 assert "like" in result['body'] assert result['body']['like'] == True
def execute_register(email, password): token, token_crypt = generate_and_encrypt_token() user = create_user(email, password, token_crypt) return True, {"user": user}, None
def _load_users_fixtures(): create_user('*****@*****.**', 'abc12345', '8c99f50fcb424c66b6e489d15461b782') create_user('*****@*****.**', 'abc12345', '9942eb5913c54f2eae5353e6b43324fb')
def _load_users_fixtures(): # Fix the fixtures too, so the app tables will be created create_user('*****@*****.**', 'abc12345', '8c99f50fcb424c66b6e489d15461b782', True) create_user('*****@*****.**', 'abc12345', '9942eb5913c54f2eae5353e6b43324fb', True)