-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Introducing UiAutomator * Using 23 api level * some local tweaks * Updated implementation based on adb commands * Nit fixes * Nit fixes * Requested changes * fix class name * update dependencies * init OppiaTestApplication.kt and TestApplicationComponent.kt * updated manifest * Nit fixes * Nit fixes * Using seperate Manifest for Test Application and instrumentation tests * bazel lint check * Nit fix * Requested changes * updated maven_install * Nit fix * Add CODEOWNERS * Added KDoc * NIT * Added comments * Added oppia_instrumentation_test.bzl * added exempted_file_path * changed to EndToEndTest modules * added exempted_file_paths * addded usesClearTextTraffix to reference the localhost * Helper utility shifted to testing module * NIT * NIT * deleted the previous utility * ignoring instrumentation in ComputeAffectedTests.kt * NIT * NIT * NIT * changed startsWith("instrumentation/") * filtered bazel targets * NIT * NIT * filtering the instrumentation from the total affected targets * NIT * changed directory to javatests * NIT * NIT * fixed scripts * NIT * Updated and NIT * Added tests for modules * updated testfile exemptions * updated the ComputedAffectedTests * ignoring player directory * Created NetworkConfigModule.kt * Fixed CI failures * NIT * Requested changes * NIT * NIT * NIT * Added kdoc * NIT * updated tests * NIT * updated computedAffectedTEsts * fix OppiaTestApplication * updated failing tests * updated ComputeAffectedTestsTest * added TestBazelWorkspace tests * fixed tests * updated test_manifest * fixed confict test
- Loading branch information
1 parent
d219920
commit 000bbc4
Showing
52 changed files
with
1,211 additions
and
107 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
7 changes: 7 additions & 0 deletions
7
data/src/main/java/org/oppia/android/data/backends/gae/BaseUrl.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,7 @@ | ||
package org.oppia.android.data.backends.gae | ||
|
||
import javax.inject.Qualifier | ||
|
||
/** Qualifier for an application-injectable string representing the server URL used for networking. */ | ||
@Qualifier | ||
annotation class BaseUrl |
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
27 changes: 27 additions & 0 deletions
27
data/src/main/java/org/oppia/android/data/backends/gae/NetworkConfigProdModule.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,27 @@ | ||
package org.oppia.android.data.backends.gae | ||
|
||
import dagger.Module | ||
import dagger.Provides | ||
|
||
/** Provides network-specific constants. */ | ||
@Module | ||
class NetworkConfigProdModule { | ||
|
||
/** Provides BaseUrl that connects to production server. */ | ||
@Provides | ||
@BaseUrl | ||
fun provideNetworkBaseUrl(): String { | ||
return "https://oppia.org" | ||
} | ||
|
||
/** | ||
* Prefix in Json response for extra layer of security in API calls | ||
* https://github.com/oppia/oppia/blob/8f9eed/feconf.py#L319 | ||
* Remove this prefix from every Json response which is achieved in [NetworkInterceptor] | ||
*/ | ||
@Provides | ||
@XssiPrefix | ||
fun provideXssiPrefix(): String { | ||
return ")]}'" | ||
} | ||
} |
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
27 changes: 0 additions & 27 deletions
27
data/src/main/java/org/oppia/android/data/backends/gae/NetworkSettings.kt
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
data/src/main/java/org/oppia/android/data/backends/gae/XssiPrefix.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,10 @@ | ||
package org.oppia.android.data.backends.gae | ||
|
||
import javax.inject.Qualifier | ||
|
||
/** | ||
* Qualifier for an application-injectable string representing the prefix in Json response used for | ||
* security in API calls. | ||
*/ | ||
@Qualifier | ||
annotation class XssiPrefix |
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
90 changes: 90 additions & 0 deletions
90
data/src/test/java/org/oppia/android/data/backends/gae/NetworkConfigProdModuleTest.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,90 @@ | ||
package org.oppia.android.data.backends.gae | ||
|
||
import android.app.Application | ||
import android.content.Context | ||
import androidx.test.core.app.ApplicationProvider | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import com.google.common.truth.Truth.assertThat | ||
import dagger.BindsInstance | ||
import dagger.Component | ||
import dagger.Module | ||
import dagger.Provides | ||
import org.junit.Before | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.robolectric.annotation.Config | ||
import org.robolectric.annotation.LooperMode | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
/** Tests for [NetworkConfigProdModule]. */ | ||
@RunWith(AndroidJUnit4::class) | ||
@LooperMode(LooperMode.Mode.PAUSED) | ||
@Config(application = NetworkConfigProdModuleTest.TestApplication::class) | ||
class NetworkConfigProdModuleTest { | ||
|
||
@field:[Inject BaseUrl] | ||
lateinit var baseUrl: String | ||
|
||
@field:[Inject XssiPrefix] | ||
lateinit var xssiPrefix: String | ||
|
||
@Before | ||
fun setUp() { | ||
setUpTestApplicationComponent() | ||
} | ||
|
||
@Test | ||
fun testModule_baseUrl_isProdUrl() { | ||
assertThat(baseUrl).isEqualTo("https://oppia.org") | ||
} | ||
|
||
@Test | ||
fun testModule_xssiPrefix_isXssiPrefix() { | ||
assertThat(xssiPrefix).isEqualTo(")]}'") | ||
} | ||
|
||
private fun setUpTestApplicationComponent() { | ||
ApplicationProvider.getApplicationContext<TestApplication>() | ||
.inject(this) | ||
} | ||
|
||
@Module | ||
class TestModule { | ||
@Provides | ||
@Singleton | ||
fun provideContext(application: Application): Context { | ||
return application | ||
} | ||
} | ||
|
||
@Singleton | ||
@Component( | ||
modules = [ | ||
TestModule::class, NetworkConfigProdModule::class | ||
] | ||
) | ||
|
||
interface TestApplicationComponent { | ||
@Component.Builder | ||
interface Builder { | ||
@BindsInstance | ||
fun setApplication(application: Application): Builder | ||
fun build(): TestApplicationComponent | ||
} | ||
|
||
fun inject(networkConfigModuleTest: NetworkConfigProdModuleTest) | ||
} | ||
|
||
class TestApplication : Application() { | ||
private val component: TestApplicationComponent by lazy { | ||
DaggerNetworkConfigProdModuleTest_TestApplicationComponent.builder() | ||
.setApplication(this) | ||
.build() | ||
} | ||
|
||
fun inject(networkConfigModuleTest: NetworkConfigProdModuleTest) { | ||
component.inject(networkConfigModuleTest) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.