aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-01-31 10:02:07 +0100
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-01-31 14:39:53 +0100
commitf896af211fcae29f55bd1a01a6d23e56ceb702e2 (patch)
tree095e03ead90a6d0533e7d99d513786f563b67184 /server
parent9a7b438110508b68b12174426645e382c9732c81 (diff)
downloadsonarqube-f896af211fcae29f55bd1a01a6d23e56ceb702e2.tar.gz
sonarqube-f896af211fcae29f55bd1a01a6d23e56ceb702e2.zip
SONAR-8649 add UT on wrong org in api/projects/provisioned
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java
index d456d49abc4..ca542b2abdc 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java
@@ -36,6 +36,7 @@ import org.sonar.db.component.ComponentTesting;
import org.sonar.db.component.SnapshotTesting;
import org.sonar.db.organization.OrganizationDto;
import org.sonar.server.exceptions.ForbiddenException;
+import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.organization.TestDefaultOrganizationProvider;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
@@ -191,6 +192,18 @@ public class ProvisionedActionTest {
underTest.newRequest().execute();
}
+ @Test
+ public void fail_with_NotFoundException_when_organization_with_specified_key_does_not_exist() {
+ TestRequest request = underTest.newRequest()
+ .setParam(PARAM_ORGANIZATION, "foo");
+ userSessionRule.login();
+
+ expectedException.expect(NotFoundException.class);
+ expectedException.expectMessage("No organization for key 'foo'");
+
+ request.execute();
+ }
+
private static ComponentDto newProvisionedProject(OrganizationDto organizationDto, String uuid) {
return ComponentTesting
.newProjectDto(organizationDto, "provisioned-uuid-" + uuid)