def test_add_song_success(self, get_url, get_tests_data): user_logic.add_user(url=urljoin(get_url, "/users/add_user"), json=get_tests_data["new_user"]) song_logic.add_song(url=urljoin(get_url, "/songs/add_song"), json=get_tests_data["add_song_success"]) user_logic.add_playlist(url=urljoin(get_url, "/users/add_playlist"), json=get_tests_data["add_playlist_success"]) playlist_logic.add_song_to_playlist( url=urljoin(get_url, "/playlists/add_song"), json=get_tests_data["add_song_to_playlist"]) user_logic.get_user(url=urljoin(get_url, "/users/get_user"), user_name=get_tests_data["new_user"]["user_name"]) assert False #cant see the song in the playlist
def test_add_friend_success(self, get_url, get_tests_data): user_logic.add_friend(url=urljoin(get_url, "/users/add_friend"), json=get_tests_data["add_friend_success"]) r = user_logic.get_user( url=urljoin(get_url, "/users/get_user"), user_name=get_tests_data["add_friend_success"]["user_name"]) assert r.ok
def test_dont_show_password(self, get_url, get_tests_data): user_logic.add_user(url=urljoin(get_url, "/users/add_user"), json=get_tests_data["new_user"]) r = user_logic.get_user( url=urljoin(get_url, "/users/get_user"), user_name=get_tests_data["new_user"]["user_name"]) print(r.text) assert "password" not in r.text
def test_add_playlist_success(self, get_url, get_tests_data): user_logic.add_user(url=urljoin(get_url, "/users/add_user"), json=get_tests_data["new_user"]) user_logic.add_playlist(url=urljoin(get_url, "/users/add_playlist"), json=get_tests_data["add_playlist_success"]) r = user_logic.get_user( url=urljoin(get_url, "/users/get_user"), user_name=get_tests_data["new_user"]["user_name"]) assert get_tests_data["add_playlist_success"][ "playlist_name"] in r.json()["data"]["playlists"]
def test_sign_up_same_id(self, get_url, get_tests_data): user_logic.add_user(url=urljoin(get_url, "/users/add_user"), json=get_tests_data["new_user"]) r2 = user_logic.get_user(url=urljoin(get_url, "/users/get_user"), user_name="lironshani") if "error" not in r2.text: r = user_logic.add_user(url=urljoin(get_url, "/users/add_user"), json=get_tests_data["new_user"]) print(r.text) assert "error" in r.text else: assert False
def test_add_playlist_twice(self, get_url, get_tests_data): user_logic.add_user(url=urljoin(get_url, "/users/add_user"), json=get_tests_data["new_user"]) r1 = user_logic.add_playlist(url=urljoin(get_url, "/users/add_playlist"), json=get_tests_data["add_playlist"]) r = user_logic.get_user( url=urljoin(get_url, "/users/get_user"), user_name=get_tests_data["new_user"]["user_name"]) if get_tests_data["add_playlist"]["playlist_name"] in r.json( )["data"]["playlists"]: r = user_logic.add_playlist(url=urljoin(get_url, "/users/add_playlist"), json=get_tests_data["add_playlist"]) assert "error" in r.text
def test_change_password_success(self, get_url, get_tests_data): user_logic.add_user(url=urljoin(get_url, "/users/add_user"), json=get_tests_data["new_user"]) user_logic.change_password( url=urljoin(get_url, "/users/change_password"), json=get_tests_data["change_password_success"]) user_logic.add_playlist( url=urljoin(get_url, "/users/add_playlist"), json=get_tests_data["add_playlist_new_password"]) r = user_logic.get_user( url=urljoin(get_url, "/users/get_user"), user_name=get_tests_data["new_user"]["user_name"]) print(r.text) assert get_tests_data["add_playlist_new_password"][ "playlist_name"] in r.json()["data"]["playlists"]