Todo for user (#3851)

* Add a simple message

* Categories are edited

* Display categories

* read whole page

* Revert wrong changes

* Add newly added category field

* Doesnt displaey alreasy added categories

* add strings for notifications

* clean code

* Readd accidentally removed imports

* Fix edit layout style

* Fix category update messages

* Pass isWikipediaButtonDisplayed information to fragment

* Remove unused class

* Fix strings

* Fix string

* Add exeption for uncategorised images too

* Revert project.xml changes

* fix update buttonvisibility issue

* Make sure it works for auto added categories too

* make the button visible

* Make the button appear when categories are entered

* Include cancel button

* Make view updated too

* Make category view edited

* Update categories in an hacky way

* Fix unnecessary method call

* Add notes for short term fix to display added category

* Fix tests

* Fix strings

* Fix click issue
This commit is contained in:
neslihanturan 2020-08-17 14:30:46 +03:00 committed by GitHub
parent f5e28834fc
commit 1856196851
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 799 additions and 36 deletions

View file

@ -2,13 +2,16 @@ package fr.free.nrw.commons.actions
import com.nhaarman.mockitokotlin2.eq
import com.nhaarman.mockitokotlin2.verify
import io.reactivex.Observable
import org.junit.Before
import org.junit.Test
import org.mockito.ArgumentMatchers
import org.mockito.Mock
import org.mockito.Mockito
import org.mockito.MockitoAnnotations
import org.wikipedia.csrf.CsrfTokenClient
import org.wikipedia.dataclient.Service
import org.wikipedia.edit.Edit
class PageEditClientTest {
@Mock
@ -20,6 +23,12 @@ class PageEditClientTest {
private lateinit var pageEditClient: PageEditClient
@Mock
lateinit var edit: Edit
@Mock
lateinit var editResult: Edit.Result
/**
* initial setup, test environment
*/
@ -46,8 +55,23 @@ class PageEditClientTest {
@Test
fun testAppendEdit() {
Mockito.`when`(csrfTokenClient.tokenBlocking).thenReturn("test")
pageEditClient.appendEdit("test", "test", "test")
Mockito.`when`(
pageEditInterface.postAppendEdit(
ArgumentMatchers.anyString(),
ArgumentMatchers.anyString(),
ArgumentMatchers.anyString(),
ArgumentMatchers.anyString()
)
).thenReturn(
Observable.just(edit)
)
Mockito.`when`(edit.edit()).thenReturn(editResult)
Mockito.`when`(editResult.editSucceeded()).thenReturn(true)
pageEditClient.appendEdit("test", "test", "test").test()
verify(csrfTokenClient).tokenBlocking
verify(pageEditInterface).postAppendEdit(eq("test"), eq("test"), eq("test"), eq("test"))
verify(edit).edit()
verify(editResult).editSucceeded()
}
/**