File tree Expand file tree Collapse file tree 3 files changed +79
-0
lines changed
libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl Expand file tree Collapse file tree 3 files changed +79
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2024 New Vector Ltd.
3+ *
4+ * SPDX-License-Identifier: AGPL-3.0-only
5+ * Please see LICENSE in the repository root for full details.
6+ */
7+
8+ package io.element.android.libraries.matrix.impl.auth
9+
10+ import com.google.common.truth.Truth.assertThat
11+ import io.element.android.libraries.matrix.api.auth.MatrixHomeServerDetails
12+ import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeRustHomeserverLoginDetails
13+ import org.junit.Test
14+
15+ class HomeserverDetailsKtTest {
16+ @Test
17+ fun `map should be correct` () {
18+ // Given
19+ val homeserverLoginDetails = FakeRustHomeserverLoginDetails (
20+ url = " https://example.org" ,
21+ supportsPasswordLogin = true ,
22+ supportsOidcLogin = false
23+ )
24+
25+ // When
26+ val result = homeserverLoginDetails.map()
27+
28+ // Then
29+ assertThat(result).isEqualTo(
30+ MatrixHomeServerDetails (
31+ url = " https://example.org" ,
32+ supportsPasswordLogin = true ,
33+ supportsOidcLogin = false
34+ )
35+ )
36+ }
37+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2024 New Vector Ltd.
3+ *
4+ * SPDX-License-Identifier: AGPL-3.0-only
5+ * Please see LICENSE in the repository root for full details.
6+ */
7+
8+ package io.element.android.libraries.matrix.impl.auth
9+
10+ import com.google.common.truth.Truth.assertThat
11+ import io.element.android.libraries.matrix.api.auth.OidcConfig
12+ import org.junit.Test
13+ import java.io.File
14+
15+ class OidcConfigurationProviderTest {
16+ @Test
17+ fun get () {
18+ val result = OidcConfigurationProvider (File (" /base" )).get()
19+ assertThat(result.redirectUri).isEqualTo(OidcConfig .REDIRECT_URI )
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2024 New Vector Ltd.
3+ *
4+ * SPDX-License-Identifier: AGPL-3.0-only
5+ * Please see LICENSE in the repository root for full details.
6+ */
7+
8+ package io.element.android.libraries.matrix.impl.fixtures.fakes
9+
10+ import org.matrix.rustcomponents.sdk.HomeserverLoginDetails
11+ import org.matrix.rustcomponents.sdk.NoPointer
12+
13+ class FakeRustHomeserverLoginDetails (
14+ private val url : String = " https://example.org" ,
15+ private val supportsPasswordLogin : Boolean = true ,
16+ private val supportsOidcLogin : Boolean = false
17+ ) : HomeserverLoginDetails(NoPointer ) {
18+ override fun url (): String = url
19+ override fun supportsOidcLogin (): Boolean = supportsOidcLogin
20+ override fun supportsPasswordLogin (): Boolean = supportsPasswordLogin
21+ }
You can’t perform that action at this time.
0 commit comments