Issue#13 Simplify swapping of URL and certificate for tests
This commit is contained in:
parent
9bdcaddb0c
commit
b278466095
13 changed files with 96 additions and 108 deletions
|
|
@ -29,12 +29,17 @@ fun createNetworkModules(
|
|||
networkSessionExpirationListenerProvider: Scope.() -> NetworkSessionExpirationListener
|
||||
): Sequence<Module> =
|
||||
sequenceOf(
|
||||
baseUrlModule(baseUrl),
|
||||
loginModule(),
|
||||
contentModule(),
|
||||
sessionlessNetworkingModule(baseUrl, enableLogging),
|
||||
sessionlessNetworkingModule(enableLogging),
|
||||
sessionNetworkingModule(networkSessionLocalStorageProvider, networkSessionExpirationListenerProvider)
|
||||
)
|
||||
|
||||
private fun baseUrlModule(baseUrl: BaseUrl) = module {
|
||||
single { baseUrl }
|
||||
}
|
||||
|
||||
private fun loginModule() = module {
|
||||
factory { LoginRemoteSourceImpl(get(), get()) }
|
||||
factory<LoginRemoteSource> { get<LoginRemoteSourceImpl>() }
|
||||
|
|
@ -48,7 +53,7 @@ private fun contentModule() = module {
|
|||
factory<ContentRemoteSource> { get<ContentRemoteSourceImpl>() }
|
||||
}
|
||||
|
||||
private fun sessionlessNetworkingModule(baseUrl: BaseUrl, enableLogging: Boolean) = module {
|
||||
private fun sessionlessNetworkingModule(enableLogging: Boolean) = module {
|
||||
factory { MoshiConverterFactory.create() }
|
||||
single(qualifier = sessionless) {
|
||||
OkHttpClient.Builder()
|
||||
|
|
@ -58,7 +63,7 @@ private fun sessionlessNetworkingModule(baseUrl: BaseUrl, enableLogging: Boolean
|
|||
}
|
||||
single(qualifier = sessionless) {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(baseUrl.baseUrl)
|
||||
.baseUrl(get<BaseUrl>().baseUrl)
|
||||
.addConverterFactory(get<MoshiConverterFactory>())
|
||||
.client(get(sessionless))
|
||||
.build()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue