From 1f88f4db8e64b26e64ae7b9022ec0921be5c1c03 Mon Sep 17 00:00:00 2001
From: komakkar <komakkar@microsoft.com>
Date: Mon, 16 Nov 2020 23:06:01 +0530
Subject: [PATCH] 403 change

---
 .../api/TestPubsubEndpointHMAC.java           | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java
index 70d81c093..812d7c305 100644
--- a/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java
+++ b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java
@@ -58,4 +58,33 @@ public class TestPubsubEndpointHMAC extends PubsubEndpointHMACTests {
         // If HTTP is a need, corresponding infra changes will be required for this test to function.
         return;
     }
+
+    // For the following 403 is the expceted result.
+    // Tracking in Issue: https://community.opengroup.org/osdu/platform/system/notification/-/issues/17
+    @Test
+    @Override
+    public void should_return401_when_accessingWithNoAccessCredentials() throws Exception{
+        ClientResponse response = descriptor.run(getArg(), testUtils.getNoAccessToken());
+        assertEquals(error(	response.getEntity(String.class)), 403, response.getStatus());
+    }
+
+    @Test
+    public void should_return401_when_noAccessOnCustomerTenant() throws Exception {
+        ClientResponse response = descriptor.runOnCustomerTenant(getArg(), getOsduTenantAdminCredentials());
+        assertEquals(error(	response.getEntity(String.class)), 403, response.getStatus());
+    }
+
+    @Test
+    @Override
+    public void should_return401_when_accessingWithEditorCredentials() throws Exception{
+        ClientResponse response = descriptor.run(getArg(), testUtils.getEditorToken());
+        assertEquals(error(	response.getEntity(String.class)), 403, response.getStatus());
+    }
+
+    @Test
+    @Override
+    public void should_return401_when_accessingWithAdminCredentials() throws Exception{
+        ClientResponse response = descriptor.run(getArg(), testUtils.getAdminToken());
+        assertEquals(error(	response.getEntity(String.class)), 403, response.getStatus());
+    }
 }
\ No newline at end of file
-- 
GitLab