Exemplo n.º 1
0
 def test_fail_pwd_too_short(self, api_client_int):
     new_user = {"email": "*****@*****.**", "password": "******"}
     try:
         api_client_int.create_user_for_tenant('foobar', new_user)
     except bravado.exception.HTTPError as e:
         assert e.response.status_code == 400
     else:
         pytest.fail("Exception expected")
Exemplo n.º 2
0
 def test_fail_malformed_body(self, api_client_int):
     new_user = {"foo": "bar"}
     try:
         api_client_int.create_user_for_tenant('foobar', new_user)
     except bravado.exception.HTTPError as e:
         assert e.response.status_code == 400
     else:
         pytest.fail("Exception expected")
Exemplo n.º 3
0
 def test_fail_no_email(self, api_client_int):
     new_user = {"password": "******"}
     try:
         api_client_int.create_user_for_tenant('foobar', new_user)
     except bravado.exception.HTTPError as e:
         assert e.response.status_code == 400
     else:
         pytest.fail("Exception expected")
Exemplo n.º 4
0
 def test_fail_no_password(self, api_client_int):
     new_user = {"email": "*****@*****.**"}
     try:
         api_client_int.create_user_for_tenant("foobar", new_user)
     except bravado.exception.HTTPError as e:
         assert e.response.status_code == 400
     else:
         pytest.fail("Exception expected")
Exemplo n.º 5
0
    def test_ok(self, api_client_int,api_client_mgmt, clean_db, ):
        user = {"email":"*****@*****.**", "password":"******"}

        with tenantadm.run_fake_create_user(user):
            api_client_int.create_user_for_tenant('foobar', user)

        auth = make_auth("foo", 'foobar')
        users = api_client_mgmt.get_users(auth)
        assert len(users) == 1
Exemplo n.º 6
0
 def test_fail_pwd_and_hash(self, api_client_int, api_client_mgmt, clean_db):
     new_user = {
         "email": "*****@*****.**",
         "password": "******",
         "password_hash": "secret1234",
     }
     try:
         api_client_int.create_user_for_tenant("foobar", new_user)
     except bravado.exception.HTTPError as e:
         assert e.response.status_code == 400
     else:
         pytest.fail("Exception expected")
Exemplo n.º 7
0
    def test_ok_pwd_hash(self, api_client_int, api_client_mgmt, clean_db_f):
        user = {
            "email": "*****@*****.**",
            "password_hash": "secret12345",
            "propagate": False,
        }

        with tenantadm.run_fake_create_user(user):
            api_client_int.create_user_for_tenant("foobar", user)

        auth = make_auth("foo", "foobar")
        users = api_client_mgmt.get_users(auth)
        assert len(users) == 1