GetDashboard: Return 'bad request' on misuse of 'inherited' flag
The 'inherited' flag may only be used for the default dashboard. Instead of returning 'not found: inherited', when the 'inherited' flag is used on a non-default dashboard, return a 'bad request' error. Change-Id: I46bc70d416c908336c28706a6c15cbd16c253f40
This commit is contained in:
@@ -22,6 +22,7 @@ import com.google.gerrit.acceptance.NoHttpd;
|
||||
import com.google.gerrit.common.data.Permission;
|
||||
import com.google.gerrit.extensions.api.projects.BranchInput;
|
||||
import com.google.gerrit.extensions.api.projects.DashboardInfo;
|
||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.server.project.DashboardsCollection;
|
||||
import org.eclipse.jgit.junit.TestRepository;
|
||||
@@ -57,8 +58,8 @@ public class DashboardIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void cannotGetDashboardWithInheritedForNonDefault() throws Exception {
|
||||
DashboardInfo info = createDashboard(DashboardsCollection.DEFAULT_DASHBOARD_NAME, "test");
|
||||
exception.expect(ResourceNotFoundException.class);
|
||||
exception.expectMessage("inherited");
|
||||
exception.expect(BadRequestException.class);
|
||||
exception.expectMessage("inherited flag can only be used with default");
|
||||
gApi.projects().name(project.get()).dashboard(info.id).get(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user