Test that code owners cannot be listed
This increases the test coverage for CodeOwnersInBranchCollection
from 92.9% to 100% and for CodeOwnersInChangeCollection from 97% to
100%. More importantly now all functions are covered.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ia608aba0265a8a70e916b35440be2d062319c9d7
diff --git a/javatests/com/google/gerrit/plugins/codeowners/acceptance/restapi/GetCodeOwnersForPathInBranchRestIT.java b/javatests/com/google/gerrit/plugins/codeowners/acceptance/restapi/GetCodeOwnersForPathInBranchRestIT.java
index 0fafad8..4a202f5 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/acceptance/restapi/GetCodeOwnersForPathInBranchRestIT.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/acceptance/restapi/GetCodeOwnersForPathInBranchRestIT.java
@@ -14,7 +14,9 @@
package com.google.gerrit.plugins.codeowners.acceptance.restapi;
+import com.google.gerrit.acceptance.RestResponse;
import com.google.gerrit.extensions.restapi.IdString;
+import org.junit.Test;
/**
* Acceptance test for the {@link
@@ -35,4 +37,14 @@
IdString.fromDecoded("master"),
IdString.fromDecoded(path));
}
+
+ @Test
+ public void cannotListCodeOwners() throws Exception {
+ RestResponse r =
+ adminRestSession.get(
+ String.format(
+ "/projects/%s/branches/%s/code_owners/",
+ IdString.fromDecoded(project.get()), IdString.fromDecoded("master")));
+ r.assertNotFound();
+ }
}
diff --git a/javatests/com/google/gerrit/plugins/codeowners/acceptance/restapi/GetCodeOwnersForPathInChangeRestIT.java b/javatests/com/google/gerrit/plugins/codeowners/acceptance/restapi/GetCodeOwnersForPathInChangeRestIT.java
index 92a7e25..99957ad 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/acceptance/restapi/GetCodeOwnersForPathInChangeRestIT.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/acceptance/restapi/GetCodeOwnersForPathInChangeRestIT.java
@@ -58,6 +58,16 @@
}
@Test
+ public void cannotListCodeOwners() throws Exception {
+ RestResponse r =
+ adminRestSession.get(
+ String.format(
+ "/changes/%s/revisions/%s/code_owners/",
+ IdString.fromDecoded(changeId), IdString.fromDecoded("current")));
+ r.assertNotFound();
+ }
+
+ @Test
public void cannotGetCodeOwnersForNonExistingPath() throws Exception {
String nonExistingPath = "/some/non/existing/path";
RestResponse r = adminRestSession.get(getUrl(nonExistingPath));