-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d82edb
commit b4029d7
Showing
3 changed files
with
32 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,9 @@ | |
import java.util.Objects; | ||
import java.util.Optional; | ||
import javax.inject.Inject; | ||
import com.google.tsunami.proto.ServiceContext; | ||
import com.google.tsunami.proto.Software; | ||
import com.google.tsunami.proto.WebServiceContext; | ||
import okhttp3.mockwebserver.Dispatcher; | ||
import okhttp3.mockwebserver.MockResponse; | ||
import okhttp3.mockwebserver.MockWebServer; | ||
|
@@ -50,6 +53,10 @@ public class KubeflowCredentialTesterTest { | |
TestCredential.create("[email protected]", Optional.of("12341234")); | ||
private static final TestCredential WRONG_CRED_1 = | ||
TestCredential.create("wrong", Optional.of("wrong")); | ||
private static final ServiceContext.Builder kubeServiceContext = | ||
ServiceContext.newBuilder() | ||
.setWebServiceContext( | ||
WebServiceContext.newBuilder().setSoftware(Software.newBuilder().setName("jenkins"))); | ||
|
||
@Before | ||
public void setup() { | ||
|
@@ -64,6 +71,9 @@ public void detect_weakCredentialsExist_returnsFirstWeakCredentials() throws Exc | |
NetworkService.newBuilder() | ||
.setNetworkEndpoint( | ||
forHostnameAndPort(mockWebServer.getHostName(), mockWebServer.getPort())) | ||
.setServiceName("http") | ||
.setServiceContext(kubeServiceContext) | ||
.setSoftware(Software.newBuilder().setName("http")) | ||
.build(); | ||
|
||
assertThat(tester.testValidCredentials(targetNetworkService, ImmutableList.of(WEAK_CRED_1))) | ||
|
@@ -77,6 +87,9 @@ public void detect_noWeakCredentials_returnsNoCredentials() throws Exception { | |
NetworkService.newBuilder() | ||
.setNetworkEndpoint( | ||
forHostnameAndPort(mockWebServer.getHostName(), mockWebServer.getPort())) | ||
.setServiceName("http") | ||
.setServiceContext(kubeServiceContext) | ||
.setSoftware(Software.newBuilder().setName("http")) | ||
.build(); | ||
assertThat(tester.testValidCredentials(targetNetworkService, ImmutableList.of(WRONG_CRED_1))) | ||
.isEmpty(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters