Exemplo n.º 1
0
def test_bad_post7():
    i_path = '/home/mark/Pictures/logo-1.jpg'
    files = None

    post_data = {
        'text': 'Hi,test',
        'program_uuid': 'b0cfa33a-4137-4d70-a162-44be5bfdac81',
        'is_private': 1,
        'tags': '',
        'url': ''
    }

    post = create_posts(post_data)
    status = _data = fields = None

    with open(i_path, 'rb') as f:
        name = os.path.basename(i_path)
        files = {'images[0]': (name, f, 'multipart/form-data')}

        print(f'files = {files}')

        status, _data, fields = post.create_post(_type=UserType.acceptor,
                                                 files=files)

    print(status)

    assert status == requests.status_codes.codes.FORBIDDEN
Exemplo n.º 2
0
def test_bad_post9():
    i_path = '/home/mark/Pictures/car.jpg'
    files = None

    post_data = {
        'text': 'Hi,test',
        'program_uuid': '39884dc4-39bb-4dd6-ab63-8cdcc5174cec',
        'is_private': -1,
        'tags': '',
        'url': ''
    }

    post = create_posts(post_data)
    status = _data = fields = None

    with open(i_path, 'rb') as f:
        name = os.path.basename(i_path)
        files = {'images[0]': (name, f, 'multipart/form-data')}

        print(f'files = {files}')

        status, _data, fields = post.create_post(_type=UserType.owner,
                                                 files=files)

    print(status)

    assert status == requests.status_codes.codes.BAD_REQUEST