Exemplo n.º 1
0
def main(args):

    parser = parse_args()
    args = parser.parse_args()
    utilsObj = TestUtils()

    chronos_url = args.chronos_url
    chronos_common_access_url = [chronos_url,
                                 chronos_url + '/scheduler/jobs',
                                 chronos_url + '/scheduler/graph/csv']

    headers = utilsObj.get_authorization_header()

    for app_url in chronos_common_access_url:
        print ("\nExecuting Test for {} endpoint \n".format(app_url))
        utilsObj.test_proxy_user_valid_permissions_read(app_url, headers)

    time.sleep(10)

    json_data = utilsObj.create_json_data("/sample_chronos_data.json")

    app_url = chronos_url + '/scheduler/iso8601'
    print ("\nExecuting Test for {} endpoint \n".format(app_url))
    utilsObj.test_proxy_user_valid_permissions_create(app_url, headers, json_data)

    time.sleep(10)

    json_data = utilsObj.create_json_data("/sample_dependency.json")
    app_url = chronos_url + '/scheduler/dependency'
    print ("\nExecuting Test for {} endpoint \n".format(app_url))
    utilsObj.test_proxy_user_valid_permissions_create(app_url, headers, json_data)

    app_url = chronos_url + '/scheduler/job/internal-test-team-sample-chronos-job'
    print ("\nExecuting Test for {} endpoint \n".format(app_url))
    utilsObj.test_proxy_user_valid_permissions_create(app_url, headers, json_data)

    app_url = chronos_url + '/scheduler/job/stat/internal-test-team-sample-chronos-job'
    print ("\nExecuting Test for {} endpoint \n".format(app_url))
    utilsObj.test_proxy_user_valid_permissions_read(app_url, headers)

    app_url = chronos_url + '/scheduler/job/internal-test-team-sample-chronos-job'
    print ("\nExecuting Test for {} endpoint \n".format(app_url))
    utilsObj.test_proxy_user_valid_permissions_delete(app_url, headers, json_data)

    app_url = chronos_url + '/scheduler/job/internal-test-team-dependency'
    print ("\nExecuting Test for {} endpoint \n".format(app_url))
    utilsObj.test_proxy_user_valid_permissions_delete(app_url, headers, json_data)

    json_data = "notjson"
    app_url = chronos_url + '/scheduler/iso8601'
    print ("\nExecuting Test for Non JSON Body \n")
    utilsObj.test_proxy_user_invalid_body(app_url, headers, json_data)

    json_data = utilsObj.create_json_data("/sample_chronos_data.json")
    json_data['name'] = "test"  # Invalid Body
    app_url = chronos_url + '/scheduler/iso8601'
    print ("\nExecuting Test for {} endpoint \n".format(app_url))
    utilsObj.test_proxy_user_invalid_body(app_url, headers, json_data)
def main(args):

    parser = parse_args()
    args = parser.parse_args()
    utilsObj = TestUtils()
    marathon_url = args.marathon_url

    app_url_list = [
        marathon_url + '/v2/apps/internal-test-team/test-app/',
        marathon_url + '/v2/apps/db1/internal-test-team/test-app/',
        marathon_url + '/v2/apps/db2/internal-test-team/test-app/'
    ]

    json_data = utilsObj.create_json_data("/sample_data.json")
    headers = utilsObj.get_authorization_header()

    for app_url in app_url_list:
        print("\nExecuting Test for {} endpoint\n".format(app_url))
        utilsObj.test_proxy_user_valid_permissions_create(
            app_url, headers, json_data)
        utilsObj.test_proxy_user_valid_permissions_read(app_url, headers)
        utilsObj.test_proxy_user_valid_permissions_delete(
            app_url, headers, json_data)

    json_data = utilsObj.create_json_data("/sample_data.json")
    app_url = marathon_url + '/v2/apps/internal-test-team/'
    print("\nExecuting Test for Invalid End Point: {}\n".format(app_url))
    utilsObj.test_invalid_end_points(app_url, headers, json_data)

    print("\nExecuting POST Without Body:\n")
    app_url = marathon_url + '/logging'
    utilsObj.test_proxy_user_valid_permissions_create_no_body(app_url, headers)

    headers = utilsObj.get_authorization_header_non_json()
    json_data = "abc=xyz.com&level=OFF"
    print("\nExecuting POST With Non JSON Body:\n")
    app_url = marathon_url + '/logging'
    utilsObj.test_proxy_user_valid_permissions_create_non_json_body(
        app_url, headers, json_data)

    print("\nAll Tests Passed \n")
def main(args):

    parser = parse_args()
    args = parser.parse_args()
    utilsObj = TestUtils()
    marathon_url = args.marathon_url

    app_url_list = [
        marathon_url + "/v2/apps/internal-test-team/test-app/",
        marathon_url + "/v2/apps/db1/internal-test-team/test-app/",
        marathon_url + "/v2/apps/db2/internal-test-team/test-app/",
    ]

    json_data = utilsObj.create_json_data("/sample_data.json")
    headers = utilsObj.get_authorization_header()

    for app_url in app_url_list:
        print("\nExecuting Test for {} endpoint\n".format(app_url))
        utilsObj.test_proxy_user_valid_permissions_create(app_url, headers, json_data)
        utilsObj.test_proxy_user_valid_permissions_read(app_url, headers)
        utilsObj.test_proxy_user_valid_permissions_delete(app_url, headers, json_data)

    json_data = utilsObj.create_json_data("/sample_data.json")
    app_url = marathon_url + "/v2/apps/internal-test-team/"
    print("\nExecuting Test for Invalid End Point: {}\n".format(app_url))
    utilsObj.test_invalid_end_points(app_url, headers, json_data)

    print("\nExecuting POST Without Body:\n")
    app_url = marathon_url + "/logging"
    utilsObj.test_proxy_user_valid_permissions_create_no_body(app_url, headers)

    headers = utilsObj.get_authorization_header_non_json()
    json_data = "abc=xyz.com&level=OFF"
    print("\nExecuting POST With Non JSON Body:\n")
    app_url = marathon_url + "/logging"
    utilsObj.test_proxy_user_valid_permissions_create_non_json_body(app_url, headers, json_data)

    print("\nAll Tests Passed \n")