Skip to content

Commit 84454b6

Browse files
committed
Annotated the failing test with Ignore
1 parent 3c2d14d commit 84454b6

1 file changed

Lines changed: 135 additions & 135 deletions

File tree

auth0/src/test/java/com/auth0/android/provider/WebAuthProviderTest.kt

Lines changed: 135 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import org.hamcrest.core.IsNot.not
4545
import org.hamcrest.core.IsNull.notNullValue
4646
import org.junit.Assert
4747
import org.junit.Before
48+
import org.junit.Ignore
4849
import org.junit.Test
4950
import org.junit.runner.RunWith
5051
import org.mockito.ArgumentMatchers
@@ -1537,74 +1538,73 @@ public class WebAuthProviderTest {
15371538
}
15381539

15391540

1540-
//TODO: Fix this failing tests in CI once the robo-electric and other dependencies are fixed
1541-
// https://auth0team.atlassian.net/browse/SDK-7752
1542-
//
1543-
// @Test
1544-
// @Throws(Exception::class)
1545-
// public fun shouldFailToResumeLoginWhenRSAKeyIsMissingFromJWKSet() {
1546-
// val pkce = Mockito.mock(PKCE::class.java)
1547-
// `when`(pkce.codeChallenge).thenReturn("challenge")
1548-
// val mockAPI = AuthenticationAPIMockServer()
1549-
// mockAPI.willReturnEmptyJsonWebKeys()
1550-
// val authCallback = mock<Callback<Credentials, AuthenticationException>>()
1551-
// val proxyAccount: Auth0 = Auth0.getInstance(JwtTestUtils.EXPECTED_AUDIENCE, mockAPI.domain)
1552-
// proxyAccount.networkingClient = SSLTestUtils.testClient
1553-
// login(proxyAccount)
1554-
// .withState("1234567890")
1555-
// .withNonce(JwtTestUtils.EXPECTED_NONCE)
1556-
// .withPKCE(pkce)
1557-
// .start(activity, authCallback)
1558-
// val managerInstance = WebAuthProvider.managerInstance as OAuthManager
1559-
// managerInstance.currentTimeInMillis = JwtTestUtils.FIXED_CLOCK_CURRENT_TIME_MS
1560-
// val jwtBody = JwtTestUtils.createJWTBody()
1561-
// jwtBody["iss"] = proxyAccount.getDomainUrl()
1562-
// val expectedIdToken = JwtTestUtils.createTestJWT("RS256", jwtBody)
1563-
// val intent = createAuthIntent(
1564-
// createHash(
1565-
// null,
1566-
// null,
1567-
// null,
1568-
// null,
1569-
// null,
1570-
// "1234567890",
1571-
// null,
1572-
// null,
1573-
// "1234"
1574-
// )
1575-
// )
1576-
// val codeCredentials =
1577-
// Credentials(
1578-
// expectedIdToken,
1579-
// "codeAccess",
1580-
// "codeType",
1581-
// "codeRefresh",
1582-
// Date(),
1583-
// "codeScope"
1584-
// )
1585-
// Mockito.doAnswer {
1586-
// callbackCaptor.firstValue.onSuccess(codeCredentials)
1587-
// null
1588-
// }.`when`(pkce).getToken(eq("1234"), callbackCaptor.capture())
1589-
// Assert.assertTrue(resume(intent))
1590-
// mockAPI.takeRequest()
1591-
// ShadowLooper.idleMainLooper()
1592-
// verify(authCallback).onFailure(authExceptionCaptor.capture())
1593-
// val error = authExceptionCaptor.firstValue
1594-
// assertThat(error, `is`(notNullValue()))
1595-
// assertThat(
1596-
// error.cause, `is`(
1597-
// Matchers.instanceOf(
1598-
// TokenValidationException::class.java
1599-
// )
1600-
// )
1601-
// )
1602-
// assertThat(
1603-
// error.cause?.message,
1604-
// `is`("Could not find a public key for kid \"key123\"")
1605-
// )
1606-
// mockAPI.shutdown()
1607-
// }
1541+
// TODO: https://auth0team.atlassian.net/browse/SDK-7752
1542+
@Test
1543+
@Ignore("Fix these failing tests in CI once Roboelectric and other dependencies are updated")
1544+
@Throws(Exception::class)
1545+
public fun shouldFailToResumeLoginWhenRSAKeyIsMissingFromJWKSet() {
1546+
val pkce = Mockito.mock(PKCE::class.java)
1547+
`when`(pkce.codeChallenge).thenReturn("challenge")
1548+
val mockAPI = AuthenticationAPIMockServer()
1549+
mockAPI.willReturnEmptyJsonWebKeys()
1550+
val authCallback = mock<Callback<Credentials, AuthenticationException>>()
1551+
val proxyAccount: Auth0 = Auth0.getInstance(JwtTestUtils.EXPECTED_AUDIENCE, mockAPI.domain)
1552+
proxyAccount.networkingClient = SSLTestUtils.testClient
1553+
login(proxyAccount)
1554+
.withState("1234567890")
1555+
.withNonce(JwtTestUtils.EXPECTED_NONCE)
1556+
.withPKCE(pkce)
1557+
.start(activity, authCallback)
1558+
val managerInstance = WebAuthProvider.managerInstance as OAuthManager
1559+
managerInstance.currentTimeInMillis = JwtTestUtils.FIXED_CLOCK_CURRENT_TIME_MS
1560+
val jwtBody = JwtTestUtils.createJWTBody()
1561+
jwtBody["iss"] = proxyAccount.getDomainUrl()
1562+
val expectedIdToken = JwtTestUtils.createTestJWT("RS256", jwtBody)
1563+
val intent = createAuthIntent(
1564+
createHash(
1565+
null,
1566+
null,
1567+
null,
1568+
null,
1569+
null,
1570+
"1234567890",
1571+
null,
1572+
null,
1573+
"1234"
1574+
)
1575+
)
1576+
val codeCredentials =
1577+
Credentials(
1578+
expectedIdToken,
1579+
"codeAccess",
1580+
"codeType",
1581+
"codeRefresh",
1582+
Date(),
1583+
"codeScope"
1584+
)
1585+
Mockito.doAnswer {
1586+
callbackCaptor.firstValue.onSuccess(codeCredentials)
1587+
null
1588+
}.`when`(pkce).getToken(eq("1234"), callbackCaptor.capture())
1589+
Assert.assertTrue(resume(intent))
1590+
mockAPI.takeRequest()
1591+
ShadowLooper.idleMainLooper()
1592+
verify(authCallback).onFailure(authExceptionCaptor.capture())
1593+
val error = authExceptionCaptor.firstValue
1594+
assertThat(error, `is`(notNullValue()))
1595+
assertThat(
1596+
error.cause, `is`(
1597+
Matchers.instanceOf(
1598+
TokenValidationException::class.java
1599+
)
1600+
)
1601+
)
1602+
assertThat(
1603+
error.cause?.message,
1604+
`is`("Could not find a public key for kid \"key123\"")
1605+
)
1606+
mockAPI.shutdown()
1607+
}
16081608

16091609
@Test
16101610
@Throws(Exception::class)
@@ -1672,73 +1672,73 @@ public class WebAuthProviderTest {
16721672
mockAPI.shutdown()
16731673
}
16741674

1675-
//TODO: Fix this failing tests in CI once the robo-electric and other dependencies are fixed
1676-
// https://auth0team.atlassian.net/browse/SDK-7752
1677-
//
1678-
// @Test
1679-
// @Throws(Exception::class)
1680-
// public fun shouldFailToResumeLoginWhenKeyIdIsMissingFromIdTokenHeader() {
1681-
// val pkce = Mockito.mock(PKCE::class.java)
1682-
// `when`(pkce.codeChallenge).thenReturn("challenge")
1683-
// val mockAPI = AuthenticationAPIMockServer()
1684-
// mockAPI.willReturnValidJsonWebKeys()
1685-
// val authCallback = mock<Callback<Credentials, AuthenticationException>>()
1686-
// val proxyAccount: Auth0 = Auth0.getInstance(JwtTestUtils.EXPECTED_AUDIENCE, mockAPI.domain)
1687-
// proxyAccount.networkingClient = SSLTestUtils.testClient
1688-
// login(proxyAccount)
1689-
// .withState("1234567890")
1690-
// .withNonce("abcdefg")
1691-
// .withPKCE(pkce)
1692-
// .start(activity, authCallback)
1693-
// val managerInstance = WebAuthProvider.managerInstance as OAuthManager
1694-
// managerInstance.currentTimeInMillis = JwtTestUtils.FIXED_CLOCK_CURRENT_TIME_MS
1695-
// val expectedIdToken =
1696-
// "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhdXRoMHwxMjM0NTY3ODkifQ.PZivSuGSAWpSU62-iHwI16Po9DgO9lN7SLB3168P03wXBkue6nxbL3beq6jjW9uuhqRKfOiDtsvtr3paGXHONarPqQ1LEm4TDg8CM6AugaphH36EjEjL0zEYo0nxz9Fv1Xu9_bWSzfmLLgRefjZ5R0muV7JlyfBgtkfG0avD3PtjlNtToXX1sN9DyhgCT-STX9kSQAlk23V1XA3c8st09QgmQRgtZC3ZmTEHqq_FTmFUkVUNM6E0LbgLR7bLcOx4Xqayp1mqZxUgTg7ynHI6Ey4No-R5_twAki_BR8uG0TxqHlPxuU9QTzEvCQxrqzZZufRv_kIn2-fqrF3yr3z4Og"
1697-
// val intent = createAuthIntent(
1698-
// createHash(
1699-
// null,
1700-
// null,
1701-
// null,
1702-
// null,
1703-
// null,
1704-
// "1234567890",
1705-
// null,
1706-
// null,
1707-
// "1234"
1708-
// )
1709-
// )
1710-
// val codeCredentials =
1711-
// Credentials(
1712-
// expectedIdToken,
1713-
// "codeAccess",
1714-
// "codeType",
1715-
// "codeRefresh",
1716-
// Date(),
1717-
// "codeScope"
1718-
// )
1719-
// Mockito.doAnswer {
1720-
// callbackCaptor.firstValue.onSuccess(codeCredentials)
1721-
// null
1722-
// }.`when`(pkce).getToken(eq("1234"), callbackCaptor.capture())
1723-
// Assert.assertTrue(resume(intent))
1724-
// mockAPI.takeRequest()
1725-
// ShadowLooper.idleMainLooper()
1726-
// verify(authCallback).onFailure(authExceptionCaptor.capture())
1727-
// val error = authExceptionCaptor.firstValue
1728-
// assertThat(error, `is`(notNullValue()))
1729-
// assertThat(
1730-
// error.cause, `is`(
1731-
// Matchers.instanceOf(
1732-
// TokenValidationException::class.java
1733-
// )
1734-
// )
1735-
// )
1736-
// assertThat(
1737-
// error.cause?.message,
1738-
// `is`("Could not find a public key for kid \"null\"")
1739-
// )
1740-
// mockAPI.shutdown()
1741-
// }
1675+
1676+
//TODO: https://auth0team.atlassian.net/browse/SDK-7752
1677+
@Test
1678+
@Ignore("Fix these failing tests in CI once Roboelectric and other dependencies are updated")
1679+
@Throws(Exception::class)
1680+
public fun shouldFailToResumeLoginWhenKeyIdIsMissingFromIdTokenHeader() {
1681+
val pkce = Mockito.mock(PKCE::class.java)
1682+
`when`(pkce.codeChallenge).thenReturn("challenge")
1683+
val mockAPI = AuthenticationAPIMockServer()
1684+
mockAPI.willReturnValidJsonWebKeys()
1685+
val authCallback = mock<Callback<Credentials, AuthenticationException>>()
1686+
val proxyAccount: Auth0 = Auth0.getInstance(JwtTestUtils.EXPECTED_AUDIENCE, mockAPI.domain)
1687+
proxyAccount.networkingClient = SSLTestUtils.testClient
1688+
login(proxyAccount)
1689+
.withState("1234567890")
1690+
.withNonce("abcdefg")
1691+
.withPKCE(pkce)
1692+
.start(activity, authCallback)
1693+
val managerInstance = WebAuthProvider.managerInstance as OAuthManager
1694+
managerInstance.currentTimeInMillis = JwtTestUtils.FIXED_CLOCK_CURRENT_TIME_MS
1695+
val expectedIdToken =
1696+
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhdXRoMHwxMjM0NTY3ODkifQ.PZivSuGSAWpSU62-iHwI16Po9DgO9lN7SLB3168P03wXBkue6nxbL3beq6jjW9uuhqRKfOiDtsvtr3paGXHONarPqQ1LEm4TDg8CM6AugaphH36EjEjL0zEYo0nxz9Fv1Xu9_bWSzfmLLgRefjZ5R0muV7JlyfBgtkfG0avD3PtjlNtToXX1sN9DyhgCT-STX9kSQAlk23V1XA3c8st09QgmQRgtZC3ZmTEHqq_FTmFUkVUNM6E0LbgLR7bLcOx4Xqayp1mqZxUgTg7ynHI6Ey4No-R5_twAki_BR8uG0TxqHlPxuU9QTzEvCQxrqzZZufRv_kIn2-fqrF3yr3z4Og"
1697+
val intent = createAuthIntent(
1698+
createHash(
1699+
null,
1700+
null,
1701+
null,
1702+
null,
1703+
null,
1704+
"1234567890",
1705+
null,
1706+
null,
1707+
"1234"
1708+
)
1709+
)
1710+
val codeCredentials =
1711+
Credentials(
1712+
expectedIdToken,
1713+
"codeAccess",
1714+
"codeType",
1715+
"codeRefresh",
1716+
Date(),
1717+
"codeScope"
1718+
)
1719+
Mockito.doAnswer {
1720+
callbackCaptor.firstValue.onSuccess(codeCredentials)
1721+
null
1722+
}.`when`(pkce).getToken(eq("1234"), callbackCaptor.capture())
1723+
Assert.assertTrue(resume(intent))
1724+
mockAPI.takeRequest()
1725+
ShadowLooper.idleMainLooper()
1726+
verify(authCallback).onFailure(authExceptionCaptor.capture())
1727+
val error = authExceptionCaptor.firstValue
1728+
assertThat(error, `is`(notNullValue()))
1729+
assertThat(
1730+
error.cause, `is`(
1731+
Matchers.instanceOf(
1732+
TokenValidationException::class.java
1733+
)
1734+
)
1735+
)
1736+
assertThat(
1737+
error.cause?.message,
1738+
`is`("Could not find a public key for kid \"null\"")
1739+
)
1740+
mockAPI.shutdown()
1741+
}
17421742

17431743
@Test
17441744
@Throws(Exception::class)

0 commit comments

Comments
 (0)