Skip to content

Commit

Permalink
Issue #414 add tests for server port and ignore Playlists menu
Browse files Browse the repository at this point in the history
  • Loading branch information
kingargyle committed Dec 16, 2018
1 parent d501719 commit edcf53b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public List<MenuItem> createMenuItems() {
}

protected boolean isImplemented(IDirectory item) {
return !"photos".equals(item.getType()) && !"photo".equals(item.getType()) && !"folders".equals(item.getType());
return !"playlists".equals(item.getType()) && !"photos".equals(item.getType()) && !"photo".equals(item.getType()) && !"folders".equals(item.getType());
}

public MenuItem createSettingsMenu() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class ServerSelectionActivity : InjectingActivity() {
}

server.ipAddress = serverIPPreference.get()
server.port = serverPortPreference.get()
server.serverName = "Preferred Server"
server.setDiscoveryProtocol(serverClientPreference.get())
servers["Manual"] = server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class LoginUserPresenter : MvpPresenter<LoginUserContract.LoginUserView>(), Logi
this.server = server

if (server.port != null) {
client.updateBaseUrl("http://${server.ipAddress}:${server.port}")
client.updateBaseUrl("http://${server.ipAddress}:${server.port}/")
} else {
client.updateBaseUrl("http://${server.ipAddress}:8096/")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package us.nineworlds.serenity.ui.activity.login

import com.birbit.android.jobqueue.JobManager
import com.nhaarman.mockito_kotlin.any
import com.nhaarman.mockito_kotlin.doReturn
import com.nhaarman.mockito_kotlin.verify
import com.nhaarman.mockito_kotlin.whenever
import com.nhaarman.mockito_kotlin.*
import org.greenrobot.eventbus.EventBus
import org.junit.Before
import org.junit.Rule
Expand Down Expand Up @@ -81,6 +78,18 @@ class LoginUserPresenterTest : InjectingTest() {
verify(mockServer).ipAddress
}

@Test
fun initPresenterUpdatesClientWithExpectedUrlWhenServerPortIsNotNull() {
doReturn("9999").whenever(mockServer).port
doReturn("192.168.0.1").whenever(mockServer).ipAddress

presenter.initPresenter(mockServer)

verify(mockSerenityClient).updateBaseUrl("http://192.168.0.1:9999/")
verify(mockServer).ipAddress
verify(mockServer, atLeastOnce()).port
}

@Test
fun allUsersJobIsCreatedAndAddedToJobManager() {
presenter.retrieveAllUsers()
Expand Down

0 comments on commit edcf53b

Please sign in to comment.