fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [fineract] thesmallstar commented on a change in pull request #1100: FINERACT-1047 Integration test for Audit trails(Create)
Date Tue, 23 Jun 2020 09:44:36 GMT

thesmallstar commented on a change in pull request #1100:
URL: https://github.com/apache/fineract/pull/1100#discussion_r444098600



##########
File path: fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AuditIntegrationTest.java
##########
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.integrationtests;
+
+import io.restassured.builder.RequestSpecBuilder;
+import io.restassured.builder.ResponseSpecBuilder;
+import io.restassured.http.ContentType;
+import io.restassured.specification.RequestSpecification;
+import io.restassured.specification.ResponseSpecification;
+import java.util.HashMap;
+import org.apache.fineract.integrationtests.common.AuditHelper;
+import org.apache.fineract.integrationtests.common.ClientHelper;
+import org.apache.fineract.integrationtests.common.OfficeHelper;
+import org.apache.fineract.integrationtests.common.Utils;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+/**
+ *
+ * @author Manthan Surkar
+ *
+ */
+public class AuditIntegrationTest {
+
+    private ResponseSpecification responseSpec;
+    private RequestSpecification requestSpec;
+    private ClientHelper clientHelper;
+
+    /**
+     * Sets up the essential settings for the TEST like contentType,
+     * expectedStatusCode. It uses the '@BeforeEach' annotation provided by
+     * jUnit.
+     */
+    @BeforeEach
+    public void setup() {
+        Utils.initializeRESTAssured();
+        this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
+        this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
+        this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
+    }
+
+    /**
+     * Here we Create/Update different Entities and verify an audit is generated
+     * for each action. This can be further extened with more entities and
+     * actions in similiar way.
+     */
+    @Test
+    public void auditShouldbeCreated() {
+        this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
+
+        // When Client is created
+        final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);

Review comment:
       Yes, I thought about it, but I thought not to mix two PRs since it has to covered in
the other PR anyways.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message