Skip to content

Commit 7197c23

Browse files
committed
webhook module test case changes
1 parent e86e585 commit 7197c23

1 file changed

Lines changed: 23 additions & 36 deletions

File tree

src/test/java/com/ost/services/WebhooksTest.java

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public Manifest getServiceManifest() {
3030
}
3131

3232
@Test
33-
public void create() throws Exception {
33+
public void webhookEndpoints() throws Exception {
3434
String version = System.getProperty("java.version");
3535
String randomUrl = "https://testingWebhooks.com/" + (System.currentTimeMillis() / 1000) + "/" + version;
3636

@@ -52,38 +52,37 @@ public void create() throws Exception {
5252
JsonElement JsonElementWithWebhookId = createResponseWithWebhook.get("id");
5353
webhookId = JsonElementWithWebhookId.getAsString();
5454

55-
}
55+
HashMap<String, Object> paramsForUpdate = new HashMap<String, Object>();
56+
ArrayList<String> arrayListforUpdate = new ArrayList<String>();
57+
arrayListforUpdate.add("devices/authorization_initiate");
58+
paramsForUpdate.put("webhook_id", this.webhookId);
59+
paramsForUpdate.put("status", "active");
60+
paramsForUpdate.put("topics", arrayList);
5661

62+
// Test-Case: Create an User.
63+
JsonObject updateResponse;
64+
updateResponse = getService().update(paramsForUpdate);
65+
validateResponseWithSuccess(updateResponse);
5766

58-
@Test
59-
public void get() throws Exception {
60-
HashMap<String, Object> params = new HashMap<String, Object>();
61-
params.put("webhook_id", this.webhookId);
67+
HashMap<String, Object> paramsForGet = new HashMap<String, Object>();
68+
paramsForGet.put("webhook_id", this.webhookId);
6269

6370
// Test-Case: Get a Webhook.
64-
JsonObject response;
65-
response = getService().get(params);
66-
validateResponseWithSuccess(response);
67-
68-
}
71+
JsonObject responseForGet;
72+
responseForGet = getService().get(paramsForGet);
73+
validateResponseWithSuccess(responseForGet);
6974

75+
HashMap<String, Object> paramsForDelete = new HashMap<String, Object>();
76+
paramsForDelete.put("webhook_id", this.webhookId);
7077

71-
@Test
72-
public void update() throws Exception {
73-
HashMap<String, Object> params = new HashMap<String, Object>();
74-
ArrayList<String> arrayList = new ArrayList<String>();
75-
arrayList.add("devices/authorization_initiate");
76-
params.put("webhook_id", getEnvironmentVariables().get("webhookId"));
77-
params.put("status", "active");
78-
params.put("topics", arrayList);
79-
80-
// Test-Case: Create an User.
81-
JsonObject response;
82-
response = getService().update(params);
83-
validateResponseWithSuccess(response);
78+
// Test-Case: Delete a Webhook.
79+
JsonObject responseForDelete;
80+
responseForDelete = getService().deleteWebhook(paramsForDelete);
81+
validateResponseWithSuccess(responseForDelete);
8482

8583
}
8684

85+
8786
@Test
8887
public void getList() throws Exception {
8988
HashMap<String, Object> params = new HashMap<String, Object>();
@@ -95,18 +94,6 @@ public void getList() throws Exception {
9594

9695
}
9796

98-
@Test
99-
public void deleteWebhook() throws Exception {
100-
HashMap<String, Object> params = new HashMap<String, Object>();
101-
params.put("webhook_id", this.webhookId);
102-
103-
// Test-Case: Delete a Webhook.
104-
JsonObject response;
105-
response = getService().deleteWebhook(params);
106-
validateResponseWithSuccess(response);
107-
108-
}
109-
11097
@Test
11198
public void verifySignature() throws Exception {
11299
String version = "2";

0 commit comments

Comments
 (0)