Esempio n. 1
0
def test_get_bucket_policy():
    """ Check whether GET bucket_policy API call returns 404 since no bucket_policy is set """
    bucket = helpers.get_bucket()
    error = helpers.raise_assertError(S3ResponseError, bucket.get_policy)
    error_response = helpers.get_err_response_status(error)
    assert error_response[0] == 404
    assert error_response[1] == 'NoSuchBucketPolicy'
Esempio n. 2
0
def test_get_cors():
    """ Check whether GET CORS API call returns 404 since no CORS Rule is set """
    bucket = helpers.get_bucket()
    error = helpers.raise_assertError(S3ResponseError, bucket.get_cors)
    # assert error.error_code == 'NoSuchCORSConfiguration'
    error_response = helpers.get_err_response_status(error)
    assert error_response[0] == 404
    assert error_response[1] == 'NoSuchCORSConfiguration'
Esempio n. 3
0
def test_get_website_configuration():
    """ Check whether GET website_configuration API call returns 404 since no website_configuration is set """
    bucket = helpers.get_bucket()
    error = helpers.raise_assertError(S3ResponseError,
                                      bucket.get_website_configuration)
    error_response = helpers.get_err_response_status(error)
    assert error_response[0] == 404
    assert error_response[1] == 'NoSuchWebsiteConfiguration'
Esempio n. 4
0
def test_get_lifecycle_policy():
    """ Check whether GET lifecycle_policy API call returns 404 since no lifecycle_policy is set """
    bucket = helpers.get_bucket()
    error = helpers.raise_assertError(S3ResponseError,
                                      bucket.get_lifecycle_config)
    # assert error.error_code == 'NoSuchCORSConfiguration'
    error_response = helpers.get_err_response_status(error)
    assert error_response[0] == 404
    assert error_response[1] == 'NoSuchLifecycleConfiguration'
Esempio n. 5
0
def test_get_file_missing_from_key():
    """ Tries to download file gsoc-test.txt which isn't yet uploaded,hence gets 404 """
    bucket = helpers.get_bucket()
    k = Key(bucket=bucket)
    k.key = 'gsoc-test.txt'
    error = helpers.raise_assertError(S3ResponseError,
                                      k.get_contents_as_string)
    error_response = helpers.get_err_response_status(error)
    assert error_response[0] == 404
    assert error_response[1] == 'NoSuchKey'
Esempio n. 6
0
def test_delete_file_uploaded():
    """ Deletes uploaded file gsoc-test.txt and checks whether response StatusCode is 204 """
    bucket = helpers.get_bucket()
    k = Key(bucket=bucket)
    k.key = 'gsoc-test.txt'
    k.delete()
    error = helpers.raise_assertError(S3ResponseError,
                                      k.get_contents_as_string)
    error_response = helpers.get_err_response_status(error)
    assert error_response[0] == 404
    assert error_response[1] == 'NoSuchKey'