-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: harden ClientCapabilityDTO for api v7 [WPB-14882] (#3151)
* feat: harden ClientCapabilityDTO for api v7 * add tests * detekt * detekt * chore: disable folders update handler (#3161) * fix: Login to second device does not have MLS capabilities RC (#3165) * feat: add usecase to get team url (WPB-14872) (#3157) (#3168) * feat: add usecase to get team url * feat:detekt * feat: detekt * feat: detekt (cherry picked from commit abcd037) * chore: upgrade to cc3, fixes new_transaction in paralell (#3170) * test: add tests for old format parser in capabilities (#3173) * Update libs.versions.toml * Update UserPropertiesEventReceiver.kt * Update UserPropertiesEventReceiver.kt * Update UserPropertiesEventReceiverTest.kt * fix * fix tests * missing imports * fix circular dependency * Trigger CI * remove not needed dependency --------- Co-authored-by: Jakub Żerko <[email protected]> Co-authored-by: Yamil Medina <[email protected]> Co-authored-by: boris <[email protected]> Co-authored-by: Oussama Hassine <[email protected]>
- Loading branch information
1 parent
f506f90
commit 5788184
Showing
9 changed files
with
120 additions
and
18 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
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
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 |
---|---|---|
|
@@ -45,7 +45,6 @@ kotlin { | |
|
||
// KTX | ||
implementation(libs.ktxDateTime) | ||
|
||
} | ||
} | ||
} | ||
|
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
66 changes: 66 additions & 0 deletions
66
...lin/com/wire/kalium/network/api/authenticated/client/ClientCapabilityDTOSerializerTest.kt
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2024 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
package com.wire.kalium.network.api.authenticated.client | ||
|
||
import kotlinx.serialization.SerializationException | ||
import kotlinx.serialization.json.Json | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertFailsWith | ||
|
||
|
||
class ClientCapabilityDTOSerializerTest { | ||
|
||
private val json = Json { ignoreUnknownKeys = true } | ||
|
||
@Test | ||
fun serialize_legal_hold_implicit_consent() { | ||
val capability = ClientCapabilityDTO.LegalHoldImplicitConsent | ||
val result = json.encodeToString(ClientCapabilityDTO.serializer(), capability) | ||
assertEquals("\"legalhold-implicit-consent\"", result) | ||
} | ||
|
||
@Test | ||
fun serialize_unknown_capability() { | ||
val capability = ClientCapabilityDTO.Unknown("custom-capability") | ||
val result = json.encodeToString(ClientCapabilityDTO.serializer(), capability) | ||
assertEquals("\"custom-capability\"", result) | ||
} | ||
|
||
@Test | ||
fun deserialize_legal_hold_implicit_consent() { | ||
val jsonString = "\"legalhold-implicit-consent\"" | ||
val result = json.decodeFromString(ClientCapabilityDTO.serializer(), jsonString) | ||
assertEquals(ClientCapabilityDTO.LegalHoldImplicitConsent, result) | ||
} | ||
|
||
@Test | ||
fun deserialize_unknown_capability() { | ||
val jsonString = "\"unknown-capability\"" | ||
val result = json.decodeFromString(ClientCapabilityDTO.serializer(), jsonString) | ||
assertEquals(ClientCapabilityDTO.Unknown("unknown-capability"), result) | ||
} | ||
|
||
@Test | ||
fun deserialization_fails_on_invalid_json_format() { | ||
val invalidJson = "12345" // Invalid format for a string | ||
assertFailsWith<SerializationException> { | ||
json.decodeFromString(ClientCapabilityDTO.serializer(), invalidJson) | ||
} | ||
} | ||
} |
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