コード例 #1
0
ファイル: test.py プロジェクト: Git-Tools/git-deploy
 def test_start(self):
     """
     start - test to ensure that ``start`` method functions
     without exception
     """
     git_deploy_obj = GitDeploy()
     try:
         git_deploy_obj.start(None)
     except GitDeployError:
         self.assertTrue(False)
コード例 #2
0
ファイル: test.py プロジェクト: Git-Tools/git-deploy
 def test_revert(self):
     """
     revert - test to ensure that ``revert`` method functions
     without exception
     """
     git_deploy_obj = GitDeploy()
     try:
         git_deploy_obj.revert(namedtuple('o', 'force')(False))
     except GitDeployError:
         self.assertTrue(False)
コード例 #3
0
 def test_log_deploys(self):
     """
     log_deploys - test to ensure that ``log_deploys`` method functions
     without exception
     """
     git_deploy_obj = GitDeploy()
     try:
         git_deploy_obj.log_deploys(namedtuple('o', 'count')(1))
     except GitDeployError:
         self.assertTrue(False)
コード例 #4
0
ファイル: test.py プロジェクト: Git-Tools/git-deploy
 def test_diff(self):
     """
     diff - test to ensure that ``diff`` method functions
     without exception
     """
     git_deploy_obj = GitDeploy()
     try:
         git_deploy_obj.diff(None)
     except GitDeployError:
         self.assertTrue(False)
コード例 #5
0
 def test_start(self):
     """
     start - test to ensure that ``start`` method functions
     without exception
     """
     git_deploy_obj = GitDeploy()
     try:
         git_deploy_obj.start(None)
     except GitDeployError:
         self.assertTrue(False)
コード例 #6
0
ファイル: test.py プロジェクト: Git-Tools/git-deploy
 def test_log_deploys(self):
     """
     log_deploys - test to ensure that ``log_deploys`` method functions
     without exception
     """
     git_deploy_obj = GitDeploy()
     try:
         git_deploy_obj.log_deploys(namedtuple('o', 'count')(1))
     except GitDeployError:
         self.assertTrue(False)
コード例 #7
0
 def test_revert(self):
     """
     revert - test to ensure that ``revert`` method functions
     without exception
     """
     git_deploy_obj = GitDeploy()
     try:
         git_deploy_obj.revert(namedtuple('o', 'force')(False))
     except GitDeployError:
         self.assertTrue(False)
コード例 #8
0
 def test_diff(self):
     """
     diff - test to ensure that ``diff`` method functions
     without exception
     """
     git_deploy_obj = GitDeploy()
     try:
         git_deploy_obj.diff(None)
     except GitDeployError:
         self.assertTrue(False)
コード例 #9
0
ファイル: test.py プロジェクト: Git-Tools/git-deploy
    def test_sync(self):
        """
        sync - test to ensure that ``sync`` method functions
        without exception
        """
        git_deploy_obj = GitDeploy()
        try:
            git_deploy_obj.start(None)
            git_deploy_obj.sync(None)

            # TODO - check tag and deploy file
        except GitDeployError:
            self.assertTrue(False)
コード例 #10
0
ファイル: test.py プロジェクト: Git-Tools/git-deploy
    def test_abort(self):
        """
        abort - test to ensure that ``abort`` method functions
        without exception
        """
        git_deploy_obj = GitDeploy()

        try:
            git_deploy_obj.start(None)
            git_deploy_obj.abort(None)

            # TODO - check lock file & commit

        except GitDeployError:
            self.assertTrue(False)
コード例 #11
0
    def test_deploy_in_progress(self):
        """
        deploy_in_progress - test to ensure that when the ``start`` method
        is called when a deployment is in progress GitDeploy exits with error
        """
        git_deploy_obj = GitDeploy()

        # TODO - ensure that the repo is "fresh"

        # Call ``start`` twice
        try:
            git_deploy_obj.start(None)
            git_deploy_obj.start(None)
        except GitDeployError as e:
            if not e.message == exit_codes[2]:
                self.assertTrue(False)
            return
        self.assertTrue(False)
コード例 #12
0
ファイル: test.py プロジェクト: Git-Tools/git-deploy
    def test_deploy_in_progress(self):
        """
        deploy_in_progress - test to ensure that when the ``start`` method
        is called when a deployment is in progress GitDeploy exits with error
        """
        git_deploy_obj = GitDeploy()

        # TODO - ensure that the repo is "fresh"

        # Call ``start`` twice
        try:
            git_deploy_obj.start(None)
            git_deploy_obj.start(None)
        except GitDeployError as e:
            if not e.message == exit_codes[2]:
                self.assertTrue(False)
            return
        self.assertTrue(False)
コード例 #13
0
    def test_sync(self):
        """
        sync - test to ensure that ``sync`` method functions
        without exception
        """
        git_deploy_obj = GitDeploy()
        try:
            git_deploy_obj.start(None)
            git_deploy_obj.sync(None)

            # TODO - check tag and deploy file
        except GitDeployError:
            self.assertTrue(False)
コード例 #14
0
    def test_abort(self):
        """
        abort - test to ensure that ``abort`` method functions
        without exception
        """
        git_deploy_obj = GitDeploy()

        try:
            git_deploy_obj.start(None)
            git_deploy_obj.abort(None)

            # TODO - check lock file & commit

        except GitDeployError:
            self.assertTrue(False)
コード例 #15
0
 def test_singleton(self):
     s1 = GitDeploy()
     s2 = GitDeploy()
     self.assertEquals(s1, s2)
コード例 #16
0
 def test_conf_deploy_root(self):
     s = GitDeploy()
     self.assertIn('deploy_root', s.config)
コード例 #17
0
 def test_conf_repo_name(self):
     s = GitDeploy()
     self.assertIn('repo_name', s.config)
コード例 #18
0
 def test_conf_top_dir(self):
     s = GitDeploy()
     self.assertIn('hook_dir', s.config)
コード例 #19
0
import tempfile

from collections import namedtuple
from git_deploy.config import log
from git_deploy.git_deploy import GitDeploy, GitMethods, GitDeployError, \
    exit_codes
from dulwich.repo import Repo
from os import mkdir, chdir
from os.path import exists
from shutil import rmtree

from git_deploy.config import configure

# Create the initial singleton
config = configure()
GitDeploy(path=config['deploy.test_repo'],
          client_path=config['deploy.test_repo'])


def setup_deco(test_method):
    """
    Performs setup and teardown calls for all tests to decouple the state if
    the repo from this testing module.
    """
    def setup_wrap(self):
        init_tmp_repo()
        try:
            test_method(self)
        finally:
            teardown_tmp_repo()

    setup_wrap.__name__ = test_method.__name__