Пример #1
0
 def test_vote_twice(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"])
     song_logic.song_up_vote(url=urljoin(get_url, "/songs/upvote"), json=get_tests_data["song_up_vote"])
     r = song_logic.song_up_vote(url=urljoin(get_url, "/songs/upvote"), json=get_tests_data["song_up_vote"])
     print(r.text)
     assert not r.ok
Пример #2
0
 def test_add_playlist_no_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.add_playlist(
         url=urljoin(get_url, "/users/add_playlist"),
         json=get_tests_data["add_playlist_no_password"])
     assert not r.ok
Пример #3
0
 def test_change_password_wrong_password(self, get_url, get_tests_data,
                                         change_password_test_case):
     user_logic.add_user(url=urljoin(get_url, "/users/add_user"),
                         json=get_tests_data["new_user"])
     r = user_logic.change_password(
         url=urljoin(get_url, "/users/change_password"),
         json=get_tests_data[change_password_test_case])
     assert "error" in r.text
Пример #4
0
 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
Пример #5
0
 def test_add_song_not_exist(self, get_url, get_tests_data):
     user_logic.add_user(url=urljoin(get_url, "/users/add_user"),
                         json=get_tests_data["new_user"])
     r = playlist_logic.add_song_to_playlist(
         url=urljoin(get_url, "/playlists/add_song"),
         json=get_tests_data["add_song_to_playlist"])
     print(r.text)
     assert "error" in r.text
Пример #6
0
 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"]
Пример #7
0
 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
Пример #8
0
 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
Пример #9
0
 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
Пример #10
0
 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"]
Пример #11
0
 def test_add_song_twice(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"])
     r = playlist_logic.add_song_to_playlist(
         url=urljoin(get_url, "/playlists/add_song"),
         json=get_tests_data["add_song_to_playlist"])
     if r.ok:
         r = playlist_logic.add_song_to_playlist(
             url=urljoin(get_url, "/playlists/add_song"),
             json=get_tests_data["add_song_to_playlist"])
         print(r.text)
         assert "error" in r.text
     else:
         assert False
Пример #12
0
 def test_down_vote_wrong_password(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"])
     r = song_logic.song_up_vote(url=urljoin(get_url, "/songs/upvote"), json=get_tests_data["song_down_vote_wrong_password"])
     assert "error" in r.text
Пример #13
0
 def test_up_vote(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"])
     song_logic.song_up_vote(url=urljoin(get_url, "/songs/upvote"), json=get_tests_data["song_up_vote"])
     r = song_logic.get_songs_by_rating_greater(url=urljoin(get_url, "/songs/ranked_songs"), rating=0)
     assert get_tests_data["add_song_success"]["song_title"] in r.json()["data"]
Пример #14
0
 def test_down_vote_less_0(self, get_url, get_tests_data):
     r = song_logic.add_song(urljoin(get_url, "/songs/add_song"), json=get_tests_data["add_song_success"])
     r1 = user_logic.add_user(url=urljoin(get_url, "/users/add_user"), json=get_tests_data["new_user"])
     r1 = song_logic.song_down_vote(url=urljoin(get_url, "/songs/downvote"), json=get_tests_data["song_down_vote"])
     r = song_logic.get_songs_by_rating_less(url=urljoin(get_url, "/songs/ranked_songs"), rating=0)
     assert r.json()["data"] == []
Пример #15
0
 def test_sign_up(self, get_url, get_tests_data, sign_up_test_case):
     r = user_logic.add_user(url=urljoin(get_url, "/users/add_user"),
                             json=get_tests_data[sign_up_test_case])
     assert not r.ok