Esempio n. 1
0
def add_posts_like_list():
    params = {
        "type": f"{media_types[0]}",
        "owner_id": f"{owner_id}",
        "item_id": f"{item_id[0]}",
        "filter": "likes",
        "friends_only": "1",
        "offset": "100",
        "count": "100",
        "access_token": f"{acces_token}",
        "v": "5.103"
    }
    response = Client.post(add_likes, params)
    check_status_code_200(response)

    print(response.json())

    v = Validator()
    v.schema = {
        "response": {
            "type": "dict",
            "schema": {
                "likes": {
                    "type": "integer"
                }
            }
        }
    }

    if v.validate(response.json()):
        print("valid data")
    else:
        print('invalid data')
        print(v.errors)
Esempio n. 2
0
 def test_add_like_invalid_elem(self):
     params = {"type": f"{MEDIA_TYPES[0]}", "item_id": "*&%!#(", "owner_id": f"{OWNER_ID}",
               "access_token": f"{ACCESS_TOKEN}",
               "v": "5.103"}
     response = Client.post(ADD_LIKES, params)
     check_status_code_200(response)
     check_invalid_body(response.json())
     print(response.json())
Esempio n. 3
0
 def test_add_like_photo(self):
     params = {"type": f"{MEDIA_TYPES[3]}", "item_id": f"{ITEM_ID[3]}", "owner_id": f"{OWNER_ID}",
               "access_token": f"{ACCESS_TOKEN}",
               "v": "5.103"}
     response = Client.post(ADD_LIKES, params)
     check_status_code_200(response)
     check_add_like_response(response.json())
     print(response.json())
Esempio n. 4
0
 def test_is_liked_invalid_photo(self):
     params = {"type": f"{MEDIA_TYPES[1]}", "item_id": "A1295612hsgfd", "owner_id": f"{OWNER_ID}",
               "access_token": f"{ACCESS_TOKEN}",
               "v": "5.103"}
     response = Client.post(ISLIKED_LIKES, params)
     check_status_code_200(response)
     check_invalid_is_liked_body(response.json())
     print(response.json())
Esempio n. 5
0
 def test_is_liked_comment(self):
     params = {"type": f"{MEDIA_TYPES[1]}", "item_id": f"{ITEM_ID[1]}", "owner_id": f"{OWNER_ID}",
               "access_token": f"{ACCESS_TOKEN}",
               "v": "5.103"}
     response = Client.post(ISLIKED_LIKES, params)
     check_status_code_200(response)
     check_isliked_response(response.json())
     print(response.json())
Esempio n. 6
0
 def test_get_photo_post_like_list(self):
     params = {
         "type": f"{MEDIA_TYPES[3]}",
         "owner_id": f"{OWNER_ID}",
         "item_id": f"{ITEM_ID[3]}",
         "filter": "likes",
         "friends_only": "1",
         "offset": "100",
         "count": "100",
         "access_token": f"{ACCESS_TOKEN}",
         "v": "5.103"
     }
     response = Client.post(GETLIST_LIKES, params)
     check_status_code_200(response)
     check_get_list_response(response.json())
     print(response.json())