Search in sources :

Example 66 with WsTester

use of org.sonar.server.ws.WsTester in project sonarqube by SonarSource.

the class TestsWsTest method setUp.

@Before
public void setUp() {
    WsTester tester = new WsTester(new TestsWs(new ListAction(mock(DbClient.class), mock(TestIndex.class), userSessionRule, mock(ComponentFinder.class)), new CoveredFilesAction(mock(DbClient.class), mock(TestIndex.class), userSessionRule)));
    controller = tester.controller("api/tests");
}
Also used : ComponentFinder(org.sonar.server.component.ComponentFinder) TestIndex(org.sonar.server.test.index.TestIndex) DbClient(org.sonar.db.DbClient) WsTester(org.sonar.server.ws.WsTester) Before(org.junit.Before)

Example 67 with WsTester

use of org.sonar.server.ws.WsTester in project sonarqube by SonarSource.

the class WebServicesWsTest method list.

@Test
public void list() throws Exception {
    WsTester tester = new WsTester(underTest, new MetricWs());
    String response = tester.newGetRequest("api/webservices", "list").execute().outputAsString();
    assertJson(response).withStrictArrayOrder().isSimilarTo(getClass().getResource("list-example.json"));
}
Also used : WsTester(org.sonar.server.ws.WsTester) Test(org.junit.Test)

Example 68 with WsTester

use of org.sonar.server.ws.WsTester in project sonarqube by SonarSource.

the class WebServicesWsTest method response_example.

@Test
public void response_example() throws Exception {
    WsTester tester = new WsTester(underTest, new MetricWs());
    tester.newGetRequest("api/webservices", "response_example").setParam("controller", "api/metric").setParam("action", "create").execute().assertJson(getClass(), "response_example.json");
}
Also used : WsTester(org.sonar.server.ws.WsTester) Test(org.junit.Test)

Example 69 with WsTester

use of org.sonar.server.ws.WsTester in project sonarqube by SonarSource.

the class DeleteActionTest method setUp.

@Before
public void setUp() {
    defaultGroup = db.users().insertGroup(db.getDefaultOrganization(), CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE);
    Settings settings = new MapSettings().setProperty(CoreProperties.CORE_DEFAULT_GROUP, CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE);
    ws = new WsTester(new UserGroupsWs(new DeleteAction(db.getDbClient(), userSession, newGroupWsSupport(), settings, defaultOrganizationProvider)));
}
Also used : MapSettings(org.sonar.api.config.MapSettings) WsTester(org.sonar.server.ws.WsTester) Settings(org.sonar.api.config.Settings) MapSettings(org.sonar.api.config.MapSettings) Before(org.junit.Before)

Example 70 with WsTester

use of org.sonar.server.ws.WsTester in project sonarqube by SonarSource.

the class UsersWsTest method setUp.

@Before
public void setUp() {
    WsTester tester = new WsTester(new UsersWs(new CreateAction(mock(UserUpdater.class), userSessionRule), new UpdateAction(mock(UserUpdater.class), userSessionRule, mock(UserJsonWriter.class), mock(DbClient.class)), new CurrentAction(userSessionRule, mock(DbClient.class), mock(DefaultOrganizationProvider.class)), new ChangePasswordAction(mock(DbClient.class), mock(UserUpdater.class), userSessionRule), new SearchAction(mock(UserIndex.class), mock(DbClient.class), mock(UserJsonWriter.class))));
    controller = tester.controller("api/users");
}
Also used : UserIndex(org.sonar.server.user.index.UserIndex) DbClient(org.sonar.db.DbClient) WsTester(org.sonar.server.ws.WsTester) DefaultOrganizationProvider(org.sonar.server.organization.DefaultOrganizationProvider) UserUpdater(org.sonar.server.user.UserUpdater) Before(org.junit.Before)

Aggregations

WsTester (org.sonar.server.ws.WsTester)71 Before (org.junit.Before)50 Test (org.junit.Test)21 DbClient (org.sonar.db.DbClient)18 ComponentFinder (org.sonar.server.component.ComponentFinder)15 WebService (org.sonar.api.server.ws.WebService)12 UserSession (org.sonar.server.user.UserSession)5 Languages (org.sonar.api.resources.Languages)4 QProfileFactory (org.sonar.server.qualityprofile.QProfileFactory)4 UserDto (org.sonar.db.user.UserDto)3 DefaultOrganizationProvider (org.sonar.server.organization.DefaultOrganizationProvider)3 UserJsonWriter (org.sonar.server.user.ws.UserJsonWriter)3 I18n (org.sonar.api.i18n.I18n)2 System2 (org.sonar.api.utils.System2)2 OrganizationDao (org.sonar.db.organization.OrganizationDao)2 RuleRepositoryDto (org.sonar.db.rule.RuleRepositoryDto)2 DefaultOrganization (org.sonar.server.organization.DefaultOrganization)2 UserUpdater (org.sonar.server.user.UserUpdater)2 UserIndex (org.sonar.server.user.index.UserIndex)2 Locale (java.util.Locale)1