Beispiel #1
0
def post_delete_success(auth, pk):
    url = urls.postdetail_url(pk)
    res = requests.delete(url, auth=auth, verify=False)

    if res.status_code != 204:
        print(
            'error!: post {0} is not deleted by user {1} who is the author of the post'
            .format(pk, auth[0]))
        exit(1)

    else:
        print('post delete success test success')
Beispiel #2
0
def post_delete_fail(auth, pk):
    url = urls.postdetail_url(pk)
    res = requests.delete(url, auth=auth)

    if res.status_code != 403:
        print(
            'error!: post {0} is deleted by user {1} who is not author of the post'
            .format(pk, auth[0]))
        exit(1)

    else:
        print('post delete fail test success')
Beispiel #3
0
def post_put_success(auth, pk):
    url = urls.postdetail_url(pk)
    data = {'text': 'revised text'}
    res = requests.put(url, data, auth=auth, verify=False)

    if res.status_code != 200:
        print(
            'error!: post {0} is not putted by user {1} who is the author of the post'
            .format(pk, auth[0]))
        exit(1)

    else:
        print('post put success test success')
Beispiel #4
0
def post_put_fail(auth, pk):
    url = urls.postdetail_url(pk)
    data = {'text': 'revised text'}
    res = requests.put(url, data, auth=auth)

    if res.status_code != 403:
        print(
            'error!: post {0} is putted by user {1} who is not author of the post'
            .format(pk, auth[0]))
        exit(1)

    else:
        print('post put fail test success')