Ejemplo n.º 1
0
 def setUpTestData(cls):
     cls.http_req = make_http_request(user_perm='auth.change_user')
     cls.username = '******'
     cls.user = f.UserFactory(username=cls.username,
                              email='*****@*****.**')
     cls.group_name = 'test_group'
     cls.group = f.GroupFactory(name=cls.group_name)
Ejemplo n.º 2
0
def test_delete_user_from_group(client, session):
    factories.UserFactory.cleanup()
    factories.GroupFactory.cleanup()
    me = factories.MeFactory(username=get_authable_username(),
                             email=get_authable_email())
    users = factories.UserFactory.create_batch(3)

    first_user_uuid = users[0].uuid
    group = factories.GroupFactory(
        user_id=me.id,
        name="my test groupio")  #user_ids=[users[0].uuid] # pass in userid
    token = get_token(client, session)
    headers = {
        'Content-Type': mimetype,
        'Accept': mimetype,
        "Authorization": "Bearer " + token
    }

    print("first uuid : " + first_user_uuid)
    url = '/api/v1/groups/' + group.uuid + '/add_user/' + first_user_uuid
    response = client.get(url, headers=headers)

    assert response.status_code == 200
    url = '/api/v1/groups/' + group.uuid
    #response = client.get(url, headers=headers)
    #print(response.json)

    url = '/api/v1/groups/' + group.uuid + '/del_user/' + first_user_uuid
    response = client.get(url, headers=headers)

    assert response.status_code == 200
Ejemplo n.º 3
0
    def setUpTestData(cls):
        cls.group_tester = f.GroupFactory()
        cls.group_reviewer = f.GroupFactory()

        cls.user1 = f.UserFactory(username='******',
                                  email='*****@*****.**',
                                  is_active=True,
                                  groups=[cls.group_tester])
        cls.user2 = f.UserFactory(username='******',
                                  email='*****@*****.**',
                                  is_active=False,
                                  groups=[cls.group_reviewer])
        cls.user3 = f.UserFactory(username='******',
                                  email='*****@*****.**',
                                  is_active=True,
                                  groups=[cls.group_reviewer])

        cls.http_req = make_http_request()
Ejemplo n.º 4
0
def test_add_user_to_group(client, session):
    factories.UserFactory.cleanup()
    factories.GroupFactory.cleanup()
    me = factories.MeFactory(username=get_authable_username(),
                             email=get_authable_email())
    users = factories.UserFactory.create_batch(3)
    group = factories.GroupFactory(user_id=me.id,
                                   name="my test groupio")  #pass in userid

    token = get_token(client, session)
    headers = {
        'Content-Type': mimetype,
        'Accept': mimetype,
        "Authorization": "Bearer " + token
    }

    url = '/api/v1/groups/' + group.uuid + '/add_user/' + users[0].uuid

    response = client.get(url, headers=headers)
    assert response.status_code == 200
Ejemplo n.º 5
0
def group():
    return factories.GroupFactory()