def test_post_cve_id_bad_amount(reg_user_headers): """ api rejects non-numeric amount when requesting IDs """ res = get_reserve_cve_ids('a', utils.CURRENT_YEAR, reg_user_headers['CVE-API-USER']) assert res.status_code == 400 assert res.reason == 'Bad Request' response_contains_json(res, 'error', 'BAD_INPUT') assert_contains(res, 'amount')
def test_put_update_org_that_does_not_exist(): """ cve services api will not update orgs that don't exist """ uid = str(uuid.uuid4()) res = requests.put(f'{env.AWG_BASE_URL}{ORG_URL}/{uid}?id_quota=100', headers=utils.BASE_HEADERS) assert res.status_code == 404 response_contains_json(res, 'error', 'ORG_DNE_PARAM') assert_contains(res, 'by the shortname parameter does not exist')
def test_put_cve_id_duplicate_state(): """ api rejects ID updates with duplicate state parameter """ res = requests.put( (f'{env.AWG_BASE_URL}{CVE_ID_URL}/{cve_id}' '?state=RESERVED&state=PUBLIC'), headers=utils.BASE_HEADERS ) assert res.status_code == 400 assert res.reason == 'Bad Request' response_contains_json(res, 'error', 'BAD_INPUT') assert_contains(res, 'state')
def test_put_update_user_personal_info(): """ services api allows user personal info to be updated by secretariat """ org, user = create_new_user_with_new_org_by_uuid() name_uid = str(uuid.uuid4()) res = requests.put(f'{env.AWG_BASE_URL}{ORG_URL}/{org}/user/{user}', headers=utils.BASE_HEADERS, params={ 'name.first': name_uid, 'name.last': name_uid, 'name.middle': name_uid, 'name.suffix': name_uid, 'name.surname': name_uid }) assert res.status_code == 200 assert_contains(res, name_uid, count=5)