Esempio n. 1
0
def test_list_raw():
    responses.add(responses.GET,
                  'http://api/v2/users',
                  json=answers.USERS_LIST)

    manager = UsersManager(client)

    users = manager.list(return_raw=True)

    assert users == answers.USERS_LIST["users"]
Esempio n. 2
0
def test_list():
    responses.add(responses.GET,
                  'http://api/v2/users',
                  json=answers.USERS_LIST)

    manager = UsersManager(client)

    users = manager.list()

    assert len(users) > 0
Esempio n. 3
0
def test_remove_user_to_proj_from_single_obj():
    responses.add(responses.GET,
                  'http://api/v2/users',
                  json=answers.USERS_LIST)
    responses.add(responses.DELETE,
                  'http://api/v2/roles/projects/100/users/666',
                  status=204)

    manager = UsersManager(client)

    user = manager.list()[0]
    user.id = 666

    assert user.remove_from_project(project_id=100) is None
Esempio n. 4
0
def test_check_if_user_in_proj_from_single_obj():
    responses.add(responses.GET,
                  'http://api/v2/users',
                  json=answers.USERS_LIST)
    responses.add(responses.GET,
                  'http://api/v2/roles/users/123',
                  json=answers.USERS_ROLE_SHOW)

    manager = UsersManager(client)

    user = manager.list()[0]
    user.id = 123

    assert not user.check_in_project('2_7111116c9ebf464d86efc16fb56d4fa3')
    assert user.check_in_project('1_7354286c9ebf464d86efc16fb56d4fa3')
Esempio n. 5
0
def test_update_name_from_single_obj():
    responses.add(responses.GET,
                  'http://api/v2/users',
                  json=answers.USERS_LIST)
    responses.add(responses.PATCH,
                  'http://api/v2/users/666',
                  json=answers.USERS_SET)

    manager = UsersManager(client)

    user = manager.list()[0]

    user.id = 666
    updated_user = user.update_name("Genry")

    assert updated_user is not None
Esempio n. 6
0
def test_add_user_to_proj_from_single_obj():
    responses.add(responses.GET,
                  'http://api/v2/users',
                  json=answers.USERS_LIST)
    responses.add(responses.POST,
                  'http://api/v2/roles/projects/123/users/666',
                  json=answers.ROLES_ADD)

    manager = UsersManager(client)

    user = manager.list()[0]
    user.id = 666

    result = user.add_to_project(project_id=123)

    assert result is not None
Esempio n. 7
0
def test_update_password_from_single_obj():
    responses.add(responses.GET,
                  'http://api/v2/users',
                  json=answers.USERS_LIST)
    responses.add(responses.PATCH,
                  'http://api/v2/users/666',
                  json=answers.USERS_SET)

    manager = UsersManager(client)

    user = manager.list()[0]

    user.id = 666
    updated_user = user.update_password(new_password="******")

    assert updated_user is not None