Files
RSSuper/android/src/test/java/com/rssuper/services/HTTPAuthCredentialsTest.kt
Michael Freno c2e1622bd8
Some checks failed
CI - Multi-Platform Native / Build iOS (RSSuper) (push) Has been cancelled
CI - Multi-Platform Native / Build macOS (push) Has been cancelled
CI - Multi-Platform Native / Build Android (push) Has been cancelled
CI - Multi-Platform Native / Build Linux (push) Has been cancelled
CI - Multi-Platform Native / Build Summary (push) Has been cancelled
restructure
2026-03-30 16:39:18 -04:00

54 lines
1.4 KiB
Kotlin

package com.rssuper.services
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertTrue
import org.junit.Test
class HTTPAuthCredentialsTest {
@Test
fun testBasicAuthCredentials() {
val auth = HTTPAuthCredentials("username", "password")
val credentials = auth.toCredentials()
assertNotNull(credentials)
assertTrue(credentials.startsWith("Basic "))
}
@Test
fun testBasicAuthCredentialsWithSpecialChars() {
val auth = HTTPAuthCredentials("user@domain", "pass!@#")
val credentials = auth.toCredentials()
assertNotNull(credentials)
assertTrue(credentials.startsWith("Basic "))
}
@Test
fun testUsernameAndPassword() {
val auth = HTTPAuthCredentials("testuser", "testpass")
assertEquals("testuser", auth.username)
assertEquals("testpass", auth.password)
}
@Test
fun testEmptyUsername() {
val auth = HTTPAuthCredentials("", "password")
val credentials = auth.toCredentials()
assertNotNull(credentials)
assertTrue(credentials.startsWith("Basic "))
}
@Test
fun testEmptyPassword() {
val auth = HTTPAuthCredentials("username", "")
val credentials = auth.toCredentials()
assertNotNull(credentials)
assertTrue(credentials.startsWith("Basic "))
}
}