1
0
mirror of https://github.com/etesync/android synced 2024-11-22 16:08:13 +00:00

Fix tests.

This commit is contained in:
Tom Hacohen 2019-11-28 18:11:56 +02:00
parent a4a129d989
commit 496b6cd633
4 changed files with 8 additions and 4 deletions

View File

@ -89,6 +89,10 @@ android {
exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE.txt'
} }
testOptions {
unitTests.returnDefaultValues = true
}
defaultConfig { defaultConfig {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@ -115,7 +115,7 @@ class HttpClient private constructor(
} }
} }
constructor(context: Context, host: String?, authToken: String): this(context) { constructor(context: Context?, host: String?, authToken: String): this(context) {
addAuthentication(host, authToken) addAuthentication(host, authToken)
} }

View File

@ -24,7 +24,7 @@ class AuthenticatorTest {
@Before @Before
@Throws(IOException::class) @Throws(IOException::class)
fun setUp() { fun setUp() {
httpClient = HttpClient.create(null) httpClient = HttpClient.Builder().build().okHttpClient
remote = HttpUrl.parse("http://localhost:8000") // FIXME: hardcode for now, should make configureable remote = HttpUrl.parse("http://localhost:8000") // FIXME: hardcode for now, should make configureable
} }

View File

@ -28,12 +28,12 @@ class ServiceTest {
@Before @Before
@Throws(Exception::class) @Throws(Exception::class)
fun setUp() { fun setUp() {
httpClient = HttpClient.create(null) httpClient = HttpClient.Builder().build().okHttpClient
remote = HttpUrl.parse("http://localhost:8000") // FIXME: hardcode for now, should make configureable remote = HttpUrl.parse("http://localhost:8000") // FIXME: hardcode for now, should make configureable
val journalAuthenticator = JournalAuthenticator(httpClient!!, remote!!) val journalAuthenticator = JournalAuthenticator(httpClient!!, remote!!)
authToken = journalAuthenticator.getAuthToken(Helpers.USER, Helpers.PASSWORD) authToken = journalAuthenticator.getAuthToken(Helpers.USER, Helpers.PASSWORD)
httpClient = HttpClient.create(null, App.log, null, authToken!!) httpClient = HttpClient.Builder(null, null, authToken!!).build().okHttpClient
/* Reset */ /* Reset */
val request = Request.Builder() val request = Request.Builder()