def test_aguments_all_ok(self):
		# mock
		mocked_sync = self.mox.CreateMock(syncgit.GitJenkinsSync)

		# expect
		self.mox.StubOutWithMock(syncgit, 'GitJenkinsSync')
		(syncgit
			.GitJenkinsSync(
				"http://localhost:8080/", "/path/to/jar", "/path/to/key",
				"Template Job", "Job %s",
				"/path/to/git", "^dev/.*$", 30
			)
			.AndReturn(mocked_sync))

		# expect
		mocked_sync.sync()


		self._mock_exists(2, lambda path: True)


		self.mox.ReplayAll()

		syncgit.main([
			"-J", "http://localhost:8080/", "-S", "/path/to/key", "-j", "/path/to/jar",
			"-G", "/path/to/git", "-T", "Template Job", "-n", "Job %s",
			"-R", "^dev/.*$", "-a", "30"
		])

		self.mox.VerifyAll()
示例#2
0
    def test_aguments_all_ok(self):
        # mock
        mocked_sync = self.mox.CreateMock(syncgit.GitJenkinsSync)

        # expect
        self.mox.StubOutWithMock(syncgit, 'GitJenkinsSync')
        (syncgit.GitJenkinsSync("http://localhost:8080/", "/path/to/jar",
                                "/path/to/key", "Template Job", "Job %s",
                                "/path/to/git", "^dev/.*$",
                                30).AndReturn(mocked_sync))

        # expect
        mocked_sync.sync()

        self._mock_exists(2, lambda path: True)

        self.mox.ReplayAll()

        syncgit.main([
            "-J", "http://localhost:8080/", "-S", "/path/to/key", "-j",
            "/path/to/jar", "-G", "/path/to/git", "-T", "Template Job", "-n",
            "Job %s", "-R", "^dev/.*$", "-a", "30"
        ])

        self.mox.VerifyAll()
		def _should_raise():
			syncgit.main([
				"-J", "http://localhost:8080/", "-S", "/path/to/key", "-j", "/path/to/jar",
				"-G", "/path/to/git", "-T", "Template Job", "-n", "Job %s",
				"-R", "^dev(REGEX-PAREN-UNBALANCED", "-a", "30"
			])
		def _should_raise():
			syncgit.main([
				"-J", "http://localhost:8080/", "-S", "/path/to/key", "-j", "/path/to/jar",
				"-G", "/path/to/git", "-T", "Template Job", "-n", "Job NO-PLACEHOLDER",
				"-R", "^dev/.*$", "-a", "30"
			])