Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Lint and test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Grisha Kruglov committed Sep 22, 2020
1 parent 55367ec commit c74f17e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ class FirefoxAccount internal constructor(

override suspend fun beginPairingFlow(
pairingUrl: String,
scopes: Set<String>, entryPoint: String
scopes: Set<String>,
entryPoint: String
) = withContext(scope.coroutineContext) {
// Eventually we should specify this as a param here, but for now, let's
// use a generic value (it's used only for server-side telemetry, so the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ class FxaAccountManagerTest {

// Try again, without any network problems this time.
`when`(mockAccount.beginOAuthFlow(any(), anyString())).thenReturn(AuthFlowUrl(EXPECTED_AUTH_STATE, "auth://url"))
`when`(constellation.finalizeDevice(any(), any(), any())).thenReturn(ServiceResult.Ok)
`when`(constellation.finalizeDevice(any(), any())).thenReturn(ServiceResult.Ok)

assertEquals("auth://url", manager.beginAuthentication())

Expand Down Expand Up @@ -1112,7 +1112,7 @@ class FxaAccountManagerTest {

// Try again, without any network problems this time.
`when`(mockAccount.beginPairingFlow(anyString(), any(), anyString())).thenReturn(AuthFlowUrl(EXPECTED_AUTH_STATE, "auth://url"))
`when`(constellation.finalizeDevice(any(), any(), any())).thenReturn(ServiceResult.Ok)
`when`(constellation.finalizeDevice(any(), any())).thenReturn(ServiceResult.Ok)

assertEquals("auth://url", manager.beginAuthentication(pairingUrl = "auth://pairing"))

Expand Down Expand Up @@ -1330,7 +1330,7 @@ class FxaAccountManagerTest {

`when`(mockAccount.deviceConstellation()).thenReturn(constellation)
`when`(mockAccount.getCurrentDeviceId()).thenReturn("testDeviceId")
`when`(constellation.finalizeDevice(any(), any(), any())).thenReturn(ServiceResult.Ok)
`when`(constellation.finalizeDevice(any(), any())).thenReturn(ServiceResult.Ok)
`when`(mockAccount.getProfile(ignoreCache = false)).thenReturn(null)
`when`(mockAccount.beginOAuthFlow(any(), anyString())).thenReturn(AuthFlowUrl(EXPECTED_AUTH_STATE, "auth://url"))
`when`(mockAccount.completeOAuthFlow(anyString(), anyString())).thenReturn(true)
Expand Down Expand Up @@ -1589,7 +1589,7 @@ class FxaAccountManagerTest {

`when`(mockAccount.getCurrentDeviceId()).thenReturn("testDeviceId")
`when`(mockAccount.deviceConstellation()).thenReturn(constellation)
`when`(constellation.finalizeDevice(any(), any(), any())).thenReturn(ServiceResult.Ok)
`when`(constellation.finalizeDevice(any(), any())).thenReturn(ServiceResult.Ok)
doAnswer {
throw FxaPanicException("500")
}.`when`(mockAccount).getProfile(ignoreCache = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,17 +307,17 @@ class UtilsKtTest {
fun `as auth flow pairing`() = runBlocking {
val account: OAuthAccount = mock()
val authFlowUrl: AuthFlowUrl = mock()
`when`(account.beginPairingFlow("http://pairing.url", emptySet())).thenReturn(authFlowUrl)
verify(account, never()).beginOAuthFlow(emptySet())
`when`(account.beginPairingFlow(eq("http://pairing.url"), eq(emptySet()), anyString())).thenReturn(authFlowUrl)
verify(account, never()).beginOAuthFlow(eq(emptySet()), anyString())
assertEquals(authFlowUrl, "http://pairing.url".asAuthFlowUrl(account, emptySet()))
}

@Test
fun `as auth flow regular`() = runBlocking {
val account: OAuthAccount = mock()
val authFlowUrl: AuthFlowUrl = mock()
`when`(account.beginOAuthFlow(emptySet())).thenReturn(authFlowUrl)
verify(account, never()).beginPairingFlow(anyString(), eq(emptySet()))
`when`(account.beginOAuthFlow(eq(emptySet()), anyString())).thenReturn(authFlowUrl)
verify(account, never()).beginPairingFlow(anyString(), eq(emptySet()), anyString())
assertEquals(authFlowUrl, null.asAuthFlowUrl(account, emptySet()))
}

Expand Down
2 changes: 1 addition & 1 deletion components/support/sync-telemetry/docs/metrics.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- AUTOGENERATED BY glean_parser. DO NOT EDIT. -->

# Metrics
This document enumerates the metrics collected by this project.
This document enumerates the metrics collected by this project using the [Glean SDK](https://mozilla.github.io/glean/book/index.html).
This project may depend on other projects which also collect metrics.
This means you might have to go searching through the dependency tree to get a full picture of everything collected by this project.

Expand Down

0 comments on commit c74f17e

Please sign in to comment.