

@pytest.mark.gen_test
def test_user_disable(session, graph, users, user_admin_perm_to_auditors, http_client, base_url):
    username = 'oliver@a.co'
    old_groups = sorted(get_groups(graph, username))
    fe_url = url(base_url, '/users/{}/disable'.format(username))
    resp = (yield session.fetch(fe_url, method='POST', headers={
        'X-Grouper-User': 'zorkian@a.co',
    }, body=urlencode({
        
    })))
    assert (resp.code == 200)
    fe_url = url(base_url, '/users/{}/enable'.format(username))
    resp = (yield http_client.fetch(fe_url, method='POST', headers={
        'X-Grouper-User': 'zorkian@a.co',
    }, body=urlencode({
        'preserve_membership': 'true',
    })))
    assert (resp.code == 200)
    graph.update_from_db(session)
    assert (old_groups == sorted(get_groups(graph, username))), 'nothing should be removed'
    fe_url = url(base_url, '/users/{}/disable'.format(username))
    resp = (yield http_client.fetch(fe_url, method='POST', headers={
        'X-Grouper-User': 'zorkian@a.co',
    }, body=urlencode({
        
    })))
    assert (resp.code == 200)
    fe_url = url(base_url, '/users/{}/enable'.format(username))
    resp = (yield http_client.fetch(fe_url, method='POST', headers={
        'X-Grouper-User': 'zorkian@a.co',
    }, body=urlencode({
        
    })))
    assert (resp.code == 200)
    graph.update_from_db(session)
    assert (len(get_groups(graph, username)) == 0), 'all group membership should be removed'

dataset/ETHPy150Open dropbox/grouper/tests/test_users.py test_user_disable/VarMisuse@61/96 `http_client`->`session`