commit | 9471c0ee1035c476d697a954f316481b2c283ae6 | [log] [tgz] |
---|---|---|
author | Edwin Kempin <ekempin@google.com> | Fri Jan 08 12:59:49 2021 +0100 |
committer | Edwin Kempin <ekempin@google.com> | Fri Jan 15 11:51:00 2021 +0100 |
tree | d0ed3230b9ac57e60444d1daec80a128b7cbf996 | |
parent | 6bc2015cca8c51fe0148f1010ae1d2f5a27f217b [diff] |
Test that CheckCodeOwnerConfigFiles REST endpoint requires authentication This slightly increases the test coverage from 89% to 90.1%. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: I6a813107aa472207f3f8994574cfdf16a0f7af3f
diff --git a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerConfigFilesIT.java b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerConfigFilesIT.java index 5be55be..91e8ca2 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerConfigFilesIT.java +++ b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerConfigFilesIT.java
@@ -71,6 +71,14 @@ } @Test + public void requiresAuthenticatedUser() throws Exception { + requestScopeOperations.setApiUserAnonymous(); + AuthException authException = + assertThrows(AuthException.class, () -> checkCodeOwnerConfigFilesIn(project)); + assertThat(authException).hasMessageThat().contains("Authentication required"); + } + + @Test public void requiresCallerToBeProjectOwner() throws Exception { requestScopeOperations.setApiUser(user.id()); AuthException authException =