nacx commented on this pull request.
> + assertEquals(module.authSAS(supplier), true);
+ }
+
+ @Test
+ void testAuthSasServiceSAS(){
+ Credentials creds = new Credentials(identity,
"sp=rl&st=2019-02-14T08:50:26Z&se=2019-02-15T08:50:26Z&sv=2018-03-28&sig=Ukow8%2GtpQpAiVZBLcWp1%2RSpFq928MAqzp%2BdrdregaB6%3D&sr=b");
+ Supplier<Credentials> supplier = Suppliers.ofInstance(creds);
+ assertEquals(module.authSAS(supplier), true);
+ }
+
+ @Test
+ void testAuthSasEmptyString(){
+ Credentials creds = new Credentials(identity, "");
+ Supplier<Credentials> supplier = Suppliers.ofInstance(creds);
+ assertEquals(module.authSAS(supplier), false);
+ }
This class has a lot of repeated code. Put all the tokens in an array and
better use the TestNG data provider to run all tests:
```java
@DataProvider(name = "sas-tokens")
public static Object[][] tokens() {
return new Object[][] {
{false, ""},
{true,
"sp=rl&st=2019-02-14T08:50:26Z&se=2019-02-15T08:50:26Z&sv=2018-03-28&sig=Ukow8%2GtpQpAiVZBLcWp1%2RSpFq928MAqzp%2BdrdregaB6%3D&sr=b"},
...
};
}
@Test(dataProvider = "sas-tokens")
private void testSASAuthentication(boolean expected, String credential) {
AzureBlobHttpApiModule module = new AzureBlobHttpApiModule();
Credentials creds = new Credentials("identity", credential);
assertEquals(module.authSAS(Suppliers.ofInstance(creds)), expected);
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1270#pullrequestreview-203697598