Ejemplo n.º 1
0
    def _do_test_fail_unprocessable_entity(
        self, api_client_mgmt, init_users, new_user, tenant_id=None
    ):
        auth = None
        if tenant_id is not None:
            auth = make_auth("foo", tenant_id)

        try:
            api_client_mgmt.create_user(new_user, auth)
        except bravado.exception.HTTPError as e:
            assert e.response.status_code == 422
Ejemplo n.º 2
0
    def _do_test_ok(self, api_client_mgmt, init_users, new_user, tenant_id=None):
        auth = None
        if tenant_id is not None:
            auth = make_auth("foo", tenant_id)

        _, r = api_client_mgmt.create_user(new_user, auth)
        assert r.status_code == 201

        users = api_client_mgmt.get_users(auth)
        assert len(users) == len(init_users) + 1

        found_user = [u for u in users if u.email == new_user["email"]]
        assert len(found_user) == 1
        found_user = found_user[0]
Ejemplo n.º 3
0
 def test_fail_pwd_too_short(self, api_client_mgmt):
     new_user = {"email": "*****@*****.**", "password": "******"}
     try:
         api_client_mgmt.create_user(new_user)
     except bravado.exception.HTTPError as e:
         assert e.response.status_code == 422
Ejemplo n.º 4
0
 def test_fail_not_an_email(self, api_client_mgmt):
     new_user = {"email": "foobar", "password": "******"}
     try:
         api_client_mgmt.create_user(new_user)
     except bravado.exception.HTTPError as e:
         assert e.response.status_code == 400
Ejemplo n.º 5
0
 def test_fail_malformed_body(self, api_client_mgmt):
     new_user = {"foo": "bar"}
     try:
         api_client_mgmt.create_user(new_user)
     except bravado.exception.HTTPError as e:
         assert e.response.status_code == 400