@Test
    public void testAddClusterConfigAsAnonUser() throws Exception {
        ConnectionParams adminConnectionParams = createAdminConnectionParams();
        String anonUserName = "nothing";
        String anonUserPwd = "nothing";

        /**
         * Create a new user (non-admin)
         */
        ClusterUtils.createUser(adminConnectionParams, clusterName, anonUserName, anonUserPwd, AmbariUserRole.NONE);

        /**
         * Create and add a configuration to our cluster using the new user's privilege
         */

        String configType = "test-hadoop-env";
        String configTag = "version1";
        ClusterConfigParams configParams = new ClusterConfigParams();
        configParams.setClusterName(clusterName);
        configParams.setConfigType(configType);
        configParams.setConfigTag(configTag);
        configParams.setProperties(new HashMap<String, String>() {{
            put("fs.default.name", "localhost:9995");
        }});

        /**
         * Attempting to create the configuration should fail with 403
         */
        ConnectionParams anonUserParams = createConnectionParams(anonUserName, anonUserPwd);
        WebRequest webRequest = new CreateConfigurationWebRequest(anonUserParams, configParams);
        WebResponse webResponse = webRequest.getResponse();
        assertEquals(HttpStatus.SC_FORBIDDEN, webResponse.getStatusCode());

        /**
         * Delete the user
         */
        JsonElement jsonResponse = RestApiUtils.executeRequest(new DeleteUserWebRequest(adminConnectionParams, "nothing"));
        LOG.info(jsonResponse);
    }
Creates an anonymous user and uses the user to add a cluster configuration.

@throws Exception
ambari-funtest/src/test/java/org/apache/ambari/funtest/server/tests/RoleBasedAccessControlBasicTest.java