def test_get_data(seeded_database, admin_client): expected = read_test_data_api() expected = [{"text": x["Text"]} for x in expected] assert SmartPagination.max_page_size >= len(expected), ( "SmartPagination's max_page_size setting must be larger than the " "size of the sample dataset for this test to run properly." ) response = admin_client.get("/api/data/?page_size={}".format(len(expected))) compare_get_response(response, expected, ["text"])
def test_get_auth_users(seeded_database, admin_client): response = admin_client.get("/api/auth_users/") compare_get_response( response, [ {"username": SEED_USERNAME, "email": SEED_EMAIL}, {"username": SEED_USERNAME2, "email": SEED_EMAIL}, # Special user created for the admin_client to run tests {"username": "******", "email": "*****@*****.**"}, ], ["username", "email"], )
def test_get_auth_users(seeded_database, admin_client): response = admin_client.get('/api/auth_users/') compare_get_response( response, [ { 'username': SEED_USERNAME, 'email': SEED_EMAIL }, { 'username': SEED_USERNAME2, 'email': SEED_EMAIL }, # Special user created for the admin_client to run tests { 'username': '******', 'email': '*****@*****.**' } ], ['username', 'email'])
def test_get_labels(seeded_database, admin_client): response = admin_client.get("/api/labels/") compare_get_response(response, [{"name": label} for label in SEED_LABELS], ["name"])
def test_get_users(seeded_database, admin_client): response = admin_client.get("/api/users/") compare_get_response(response, [{}], [])
def test_get_projects(seeded_database, admin_client): response = admin_client.get("/api/projects/") compare_get_response(response, [{"name": SEED_PROJECT}], ["name"])
def test_get_labels(seeded_database, admin_client): response = admin_client.get('/api/labels/') compare_get_response(response, [{ 'name': label } for label in SEED_LABELS], ['name'])
def test_get_projects(seeded_database, admin_client): response = admin_client.get('/api/projects/') compare_get_response(response, [{'name': SEED_PROJECT}], ['name'])