fun testSuitableVcsRootIsDetectedFromSubproject()

in src/test-integration/kotlin/org/jetbrains/teamcity/github/IntegrationUtilTest.kt [65:86]


    fun testSuitableVcsRootIsDetectedFromSubproject() {
        val p1 = myFixture.createProject("P1")
        val p2 = myFixture.createProject("P2", p1)

        val bt1 = registerBuildType("BT1", p1, "Ant")
        val bt2 = registerBuildType("BT2", p2, "Ant")

        val vcs = addGitVcsRoot(p1, "https://github.com/Owner/Name")

        bt1.addVcsRoot(vcs)
        bt2.addVcsRoot(vcs)

        then(getSuitableVcsRoots(p1)).containsExactly(vcs)
        then(getSuitableVcsRoots(p2)).containsExactly(vcs)

        // Note: there's no connection in P1
        addGitHubConnection(p2)

        then(getVcsRootsWhereHookCanBeInstalled(p2)).containsExactlyElementsOf(bt2.vcsRootInstances)

        then(getVcsRootsWhereHookCanBeInstalled(p1)).isEmpty()
    }