-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1577 from dhis2/master-dev
fix: [MASTER-DEV] Release 1.4.1
- Loading branch information
Showing
46 changed files
with
848 additions
and
406 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
79 changes: 79 additions & 0 deletions
79
...a/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCallMockIntegrationShould.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,79 @@ | ||
package org.hisp.dhis.android.core.datavalue.internal | ||
|
||
import com.google.common.truth.Truth.assertThat | ||
import org.hisp.dhis.android.core.common.State | ||
import org.hisp.dhis.android.core.maintenance.D2Error | ||
import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataEnqueable | ||
import org.hisp.dhis.android.core.utils.runner.D2JunitRunner | ||
import org.junit.After | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
@RunWith(D2JunitRunner::class) | ||
class DataValuePostCallMockIntegrationShould : BaseMockIntegrationTestMetadataEnqueable() { | ||
|
||
@After | ||
@Throws(D2Error::class) | ||
fun tearDown() { | ||
d2.wipeModule().wipeData() | ||
} | ||
|
||
@Test | ||
fun post_dataValues_success() { | ||
// Given user sets correct data values | ||
dhis2MockServer.enqueueMockResponse("datavalueset/data_value_set_success.json") | ||
provideDataValues("30", "40") | ||
|
||
// When user sync data in order to upload the data values | ||
d2.dataValueModule().dataValues().blockingUpload() | ||
|
||
// Then all data set should be properly synced | ||
val warnings = d2.dataValueModule().dataValues().byState().eq(State.SYNCED).blockingGet() | ||
assertThat(warnings.size).isEqualTo(2) | ||
} | ||
|
||
@Test | ||
fun post_dataValues_warning() { | ||
// Given user sets one unsupported type of data value | ||
dhis2MockServer.enqueueMockResponse("datavalueset/data_value_set_warning.json") | ||
provideDataValues("30", "40L") | ||
|
||
// When user sync data in order to upload the data values | ||
d2.dataValueModule().dataValues().blockingUpload() | ||
|
||
// Then one data set should marked as WARNING | ||
val warnings = d2.dataValueModule().dataValues().byState().eq(State.WARNING).blockingGet() | ||
assertThat(warnings.size).isEqualTo(1) | ||
} | ||
|
||
@Test | ||
fun post_dataValues_undetermined_warning() { | ||
// Given user sets one undetermined data value | ||
dhis2MockServer.enqueueMockResponse("datavalueset/data_value_set_warning.json") | ||
provideDataValues("40", "50L") | ||
|
||
// When user sync data in order to upload the data values | ||
d2.dataValueModule().dataValues().blockingUpload() | ||
|
||
// Then all data values should be marked as WARNING | ||
val warnings = d2.dataValueModule().dataValues().byState().eq(State.WARNING).blockingGet() | ||
assertThat(warnings.size).isEqualTo(2) | ||
} | ||
|
||
private fun provideDataValues(value1: String, value2: String) { | ||
d2.dataValueModule().dataValues().value( | ||
"20191021", | ||
"DiszpKrYNg8", | ||
"Ok9OQpitjQr", | ||
"DwrQJzeChWp", | ||
"DwrQJzeChWp" | ||
).blockingSet(value1) | ||
d2.dataValueModule().dataValues().value( | ||
"20191021", | ||
"DiszpKrYNg8", | ||
"vANAXwtLwcT", | ||
"bRowv6yZOF2", | ||
"bRowv6yZOF2" | ||
).blockingSet(value2) | ||
} | ||
} |
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
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,2 @@ | ||
# Adds column ProgramStage.dueDateLabel | ||
ALTER TABLE ProgramStage ADD COLUMN dueDateLabel TEXT; |
Oops, something went wrong.