generated from JetBrains/intellij-platform-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
27 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
42 changes: 42 additions & 0 deletions
42
src/test/kotlin/com/dsoftware/ghmanager/TestWindowTabController.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,42 @@ | ||
package com.dsoftware.ghmanager | ||
|
||
import com.dsoftware.ghmanager.api.model.WorkflowRuns | ||
import io.mockk.every | ||
import io.mockk.mockk | ||
import io.mockk.mockkObject | ||
import io.mockk.mockkStatic | ||
import junit.framework.TestCase | ||
import org.jetbrains.plugins.github.api.GithubApiRequest | ||
import org.jetbrains.plugins.github.api.GithubApiRequestExecutor | ||
import org.jetbrains.plugins.github.util.GHCompatibilityUtil | ||
import javax.swing.JPanel | ||
|
||
class TestWindowTabController : GitHubActionsManagerBaseTest() { | ||
override fun setUp() { | ||
super.setUp() | ||
mockGhActionsService(setOf("http://github.com/owner/repo"), setOf("account1")) | ||
mockkStatic(GHCompatibilityUtil::class) | ||
every { GHCompatibilityUtil.getOrRequestToken(any(), any()) } returns "token" | ||
|
||
mockkObject(GithubApiRequestExecutor.Factory) | ||
every { GithubApiRequestExecutor.Factory.getInstance() } returns mockk<GithubApiRequestExecutor.Factory> { | ||
every { create(any(), useProxy = false) } returns mockk<GithubApiRequestExecutor>(relaxed = true) { | ||
every { execute(any(), any<GithubApiRequest<WorkflowRuns>>()) } returns WorkflowRuns(0, emptyList()) | ||
} | ||
} | ||
|
||
factory.init(toolWindow) | ||
executeSomeCoroutineTasksAndDispatchAllInvocationEvents(project) | ||
} | ||
|
||
fun testGitHubAccountWithReposPanel() { | ||
|
||
|
||
TestCase.assertEquals(1, toolWindow.contentManager.contentCount) | ||
val content = toolWindow.contentManager.contents[0] | ||
TestCase.assertEquals("owner/repo", content.displayName) | ||
TestCase.assertTrue(content.component is JPanel) | ||
val panel = content.component as JPanel | ||
TestCase.assertEquals(1, panel.componentCount) | ||
} | ||
} |
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