def test_manualNoApi(self, requestMock): config_test.CONFIG.pop("defaultApi", None) CONTEXT.CONFIG = config_test.CONFIG main.deploy("TestRepo-Bitbucket") self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.deploy_repoConfigNoApi))
def test_push_releaseOnly(self, requestMock): self.setupRequestMock(requestMock, name=".Releases") main.bitbucket() self.assertTrue(not os.path.exists( self.pathRelativeToDeployPath("TestRepo-Bitbucket-Releases"))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_releaseNotSupported))
def test_push_tagOnly(self, requestMock): self.setupRequestMock(requestMock, name=".Tags") main.bitbucket() self.assertTrue(not os.path.exists( self.pathRelativeToDeployPath("TestRepo-Bitbucket-Tags"))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_tagRequiredNoTag))
def test_push_develop(self, requestMock): self.setupRequestMock(requestMock, branch="develop") main.gitlab() self.assertTrue(os.path.exists(self.pathRelativeToDeployPath("TestRepo-Gitlab-develop"))) self.assertTrue(os.path.exists(os.path.join(self.pathRelativeToDeployPath("TestRepo-Gitlab-develop"), self.latestPush_at_develop))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_deploySuccess))
def test_create_notLatestTag(self, requestMock): self.setupRequestMock(requestMock, event="Tag Push Hook", branch="master", tag_name="dev18") main.gitlab() self.assertTrue(os.path.exists(self.pathRelativeToDeployPath("TestRepo-Gitlab-Tags"))) self.assertTrue(os.path.exists(os.path.join(self.pathRelativeToDeployPath("TestRepo-Gitlab-Tags"), self.latestTag))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_deploySuccess, TEST_SEQs.dl_notNewestTag))
def test_releaseOnly(self, requestMock): # abort because of release only branch requestMock.args = self.setupArgs() self.deployWrap(branch=".Releases") self.assertTrue(not os.path.exists(self.pathRelativeToDeployPath("TestRepo-Releases"))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_tagRequiredNoTag))
def test_ignoreWhitelist(self, requestMock): # pulls latest push@noWhitelist requestMock.args = self.setupArgs(force=True) self.deployWrap(branch="noWhitelist") self.assertTrue(os.path.exists(self.pathRelativeToDeployPath("TestRepo-noWhitelist"))) self.assertTrue(os.path.exists(os.path.join(self.pathRelativeToDeployPath("TestRepo-noWhitelist"), self.latestPush_at_noWhitelist))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_deploySuccess, TEST_SEQs.dl_autoDeployConfigDisabledOW))
def test_noWhitelist(self, requestMock): # not on whitelist requestMock.args = self.setupArgs() self.deployWrap(branch="noWhitelist") self.assertTrue(not os.path.exists(self.pathRelativeToDeployPath("TestRepo-noWhitelist"))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_autoDeployConfigDisabled))
def test_releaseOnlyOW(self, requestMock): # pull latest push@master requestMock.args = self.setupArgs(ignoreRelease=True) self.deployWrap(branch=".Releases") self.assertTrue(os.path.exists(self.pathRelativeToDeployPath("TestRepo-Releases"))) self.assertTrue(os.path.exists(os.path.join(self.pathRelativeToDeployPath("TestRepo-Releases"), self.latestPush_at_master))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_deploySuccess, TEST_SEQs.dl_tagRequiredNoTagOW))
def test_releaseOnlyNotNewestReleaseOW(self, requestMock): # pull specified tag requestMock.args = self.setupArgs(ignoreRelease=True) self.deployWrap(branch=".Releases", tag="dev18") self.assertTrue(os.path.exists(self.pathRelativeToDeployPath("TestRepo-Releases"))) self.assertTrue(os.path.exists(os.path.join(self.pathRelativeToDeployPath("TestRepo-Releases"), "dev18.txt"))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_deploySuccess, TEST_SEQs.dl_releaseOnlyNotLatestRelRelKnownOW))
def test_push_noWhitelist(self, requestMock): self.setupRequestMock(requestMock, name="noWhitelist") main.bitbucket() self.assertTrue((not os.path.exists( self.pathRelativeToDeployPath("TestRepo-Bitbucket-noWhitelist")))) self.assertTrue( verifyTEST_SEQUENCE(TEST_SEQs.dl_autoDeployConfigDisabled))
def test_tagOnlyNotNewestTag(self, requestMock): # pull latest tag requestMock.args = self.setupArgs() self.deployWrap(branch=".Tags", tag="dev18") self.assertTrue(os.path.exists(self.pathRelativeToDeployPath("TestRepo-Tags"))) self.assertTrue(os.path.exists(os.path.join(self.pathRelativeToDeployPath("TestRepo-Tags"), self.latestTag))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_deploySuccess, TEST_SEQs.dl_notNewestTag))
def test_master(self, requestMock): # pull latest push@master requestMock.args = self.setupArgs() self.deployWrap() self.assertTrue(os.path.exists(self.pathRelativeToDeployPath("TestRepo"))) self.assertTrue(os.path.exists(os.path.join(self.pathRelativeToDeployPath("TestRepo"), self.latestPush_at_master))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_deploySuccess))
def test_latestRelease(self, requestMock): # pull latest release requestMock.args = self.setupArgs() self.deployWrap(branch=".Tags", tag="latestRelease") self.assertTrue(os.path.exists(self.pathRelativeToDeployPath("TestRepo-Tags"))) self.assertTrue(os.path.exists(os.path.join(self.pathRelativeToDeployPath("TestRepo-Tags"), self.latestReleaseTag))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_deploySuccess, TEST_SEQs.dl_nwhTagLatestRelease))
def test_develop(self, requestMock): # pull latest push@develop requestMock.args = self.setupArgs() self.deployWrap(branch="develop") self.assertTrue(os.path.exists(self.pathRelativeToDeployPath("TestRepo-develop"))) self.assertTrue(os.path.exists(os.path.join(self.pathRelativeToDeployPath("TestRepo-develop"), self.latestPush_at_develop))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_deploySuccess))
def test_releaseOnlyNotNewestRelease(self, requestMock): # pull latest release requestMock.args = self.setupArgs() self.deployWrap(branch=".Releases", tag="dev18") self.assertTrue(os.path.exists(self.pathRelativeToDeployPath("TestRepo-Releases"))) self.assertTrue(os.path.exists(os.path.join(self.pathRelativeToDeployPath("TestRepo-Releases"), self.latestReleaseTag))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_deploySuccess, TEST_SEQs.dl_releaseOnlyNotLatestRelRelKnown))
def test_releaseOnlyReleaseUnknown(self, requestMock): # abort latest release unknown on releaseOnly branch requestMock.args = self.setupArgs() config_test.CONFIG["github"]["username"] = "******" CONTEXT.CONFIG = config_test.CONFIG self.deployWrap(branch=".Releases", tag="dev18") self.assertTrue(not os.path.exists(self.pathRelativeToDeployPath("TestRepo-Releases"))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.release_invalidCredentials, TEST_SEQs.dl_releaseOnlyRelUnknown))
def test_releaseOnlyReleaseUnknownOW(self, requestMock): # pulls spevified tag requestMock.args = self.setupArgs(ignoreRelease=True) config_test.CONFIG["github"]["username"] = "******" CONTEXT.CONFIG = config_test.CONFIG self.deployWrap(branch=".Releases", tag="dev18") self.assertTrue(os.path.exists(self.pathRelativeToDeployPath("TestRepo-Releases"))) self.assertTrue(os.path.exists(os.path.join(self.pathRelativeToDeployPath("TestRepo-Releases"), "dev18.txt"))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_deploySuccess, TEST_SEQs.release_invalidCredentials, TEST_SEQs.dl_releaseOnlyRelUnknownOW))
def test_push_master(self, requestMock): self.setupRequestMock(requestMock) main.bitbucket() self.assertTrue( os.path.exists( self.pathRelativeToDeployPath("TestRepo-Bitbucket"))) self.assertTrue( os.path.exists( os.path.join( self.pathRelativeToDeployPath("TestRepo-Bitbucket"), self.latestPush_at_master))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_deploySuccess))
def test_create_latestTag(self, requestMock): self.setupRequestMock(requestMock, type="tag", name=self.latestTag.replace(".txt", "")) main.bitbucket() self.assertTrue( os.path.exists( self.pathRelativeToDeployPath("TestRepo-Bitbucket-Tags"))) self.assertTrue( os.path.exists( os.path.join( self.pathRelativeToDeployPath("TestRepo-Bitbucket-Tags"), self.latestTag))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_deploySuccess))
def test_push_tagOnly(self, requestMock): self.setupRequestMock(requestMock, branch=".Tags") main.gitlab() self.assertTrue(not os.path.exists(self.pathRelativeToDeployPath("TestRepo-Gitlab-Tags"))) self.assertTrue(verifyTEST_SEQUENCE(TEST_SEQs.dl_tagRequiredNoTag))
def test_manualWrongApi(self, requestMock): # repo not found, using github default API main.deploy("TestRepo-Bitbucket") self.assertTrue(verifyTEST_SEQUENCE())