mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Handle null URI while uploading picture (#2262)
* Handle null URI while uploading picture * Modify cache method to never return null path * Fix tests
This commit is contained in:
parent
e69c03cf83
commit
e773a82206
6 changed files with 71 additions and 36 deletions
|
|
@ -64,10 +64,8 @@ class UploadModelTest {
|
|||
|
||||
`when`(context!!.applicationContext)
|
||||
.thenReturn(mock(Application::class.java))
|
||||
`when`(fileUtilsWrapper!!.createCopyPathAndCopy(any(Uri::class.java), any(Context::class.java)))
|
||||
`when`(fileUtilsWrapper!!.createCopyPathAndCopy(anyBoolean(), any(Uri::class.java), nullable(ContentResolver::class.java), any(Context::class.java)))
|
||||
.thenReturn("file.jpg")
|
||||
`when`(fileUtilsWrapper!!.createExternalCopyPathAndCopy(any(Uri::class.java), any(ContentResolver::class.java)))
|
||||
.thenReturn("extFile.jpg")
|
||||
`when`(fileUtilsWrapper!!.getFileExt(anyString()))
|
||||
.thenReturn("jpg")
|
||||
`when`(fileUtilsWrapper!!.getSHA1(any(InputStream::class.java)))
|
||||
|
|
@ -111,7 +109,7 @@ class UploadModelTest {
|
|||
fun verifyPreviousNotAvailableForDirectUpload() {
|
||||
val element = mock(Uri::class.java)
|
||||
uploadModel!!.receiveDirect(element, "image/jpeg", "external", "Q1", "Test", "Test", { _, _ -> }
|
||||
, "")
|
||||
, "")
|
||||
assertFalse(uploadModel!!.isPreviousAvailable)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue