@Test public void load_sets_organization_parameter_if_defined_in_settings() throws IOException { when(properties.organizationKey()).thenReturn(Optional.of("my-org")); prepareCallWithResults(); underTest.load("foo", null); verifyCalledPath("/api/qualityprofiles/search.protobuf?projectKey=foo&organization=my-org"); }
@Test public void loadDefault_sets_organization_parameter_if_defined_in_settings() throws IOException { when(properties.organizationKey()).thenReturn(Optional.of("my-org")); WsTestUtil.mockStream(wsClient, "/api/qualityprofiles/search.protobuf?defaults=true&organization=my-org", createStreamOfProfiles("qp")); WsTestUtil.mockStream(wsClient, "/api/qualityprofiles/search.protobuf?profileName=foo&organization=my-org", createStreamOfProfiles("qp")); underTest.loadDefault("foo"); verifyCalledPath("/api/qualityprofiles/search.protobuf?defaults=true&organization=my-org"); verifyCalledPath("/api/qualityprofiles/search.protobuf?profileName=foo&organization=my-org"); }
@Test public void loadDefault_gets_all_default_profiles() throws IOException { prepareCallWithResults(); underTest.loadDefault(null); verifyCalledPath("/api/qualityprofiles/search.protobuf?defaults=true"); }
@Test public void load_gets_profiles_for_specified_project_and_profile_name() throws IOException { WsTestUtil.mockStream(wsClient, "/api/qualityprofiles/search.protobuf?projectKey=foo", createStreamOfProfiles("qp")); WsTestUtil.mockStream(wsClient, "/api/qualityprofiles/search.protobuf?profileName=bar", createStreamOfProfiles("qp")); underTest.load("foo", "bar"); verifyCalledPath("/api/qualityprofiles/search.protobuf?projectKey=foo"); verifyCalledPath("/api/qualityprofiles/search.protobuf?profileName=bar"); }
@Test public void load_gets_all_profiles_for_specified_project() throws IOException { prepareCallWithResults(); underTest.load("foo", null); verifyCalledPath("/api/qualityprofiles/search.protobuf?projectKey=foo"); }
@Test public void load_encodes_url_parameters() throws IOException { WsTestUtil.mockStream(wsClient, "/api/qualityprofiles/search.protobuf?projectKey=foo%232", createStreamOfProfiles("qp")); WsTestUtil.mockStream(wsClient, "/api/qualityprofiles/search.protobuf?profileName=bar%232", createStreamOfProfiles("qp")); underTest.load("foo#2", "bar#2"); verifyCalledPath("/api/qualityprofiles/search.protobuf?projectKey=foo%232"); verifyCalledPath("/api/qualityprofiles/search.protobuf?profileName=bar%232"); }
@Test public void loadDefault_gets_profiles_with_specified_name() throws IOException { WsTestUtil.mockStream(wsClient, "/api/qualityprofiles/search.protobuf?defaults=true", createStreamOfProfiles("qp")); WsTestUtil.mockStream(wsClient, "/api/qualityprofiles/search.protobuf?profileName=foo", createStreamOfProfiles("qp")); underTest.loadDefault("foo"); verifyCalledPath("/api/qualityprofiles/search.protobuf?defaults=true"); verifyCalledPath("/api/qualityprofiles/search.protobuf?profileName=foo"); }