Example #1
0
    def test_new_release_skip_existing(self, mock_unmerged, mock_unstaged):
        """
        _test_new_release_

        """
        mock_unstaged.return_value = False
        mock_unmerged.return_value = ['1.2.4']
        opts = mock.Mock()
        opts.micro = True
        opts.major = False
        opts.minor = False
        opts.nightly = False
        opts.bump = None
        opts.skip_existing = True

        # should create a new minor release, editing
        # the cirrus config in the test dir
        new_release(opts)

        # verify new version
        new_conf = Configuration(self.config)
        new_conf.load()
        self.assertEqual(new_conf.package_version(), '1.2.5')

        self.failUnless(self.mock_pull.called)
        self.assertEqual(self.mock_pull.call_args[0][1], 'develop')
        self.failUnless(self.mock_branch.called)
        self.assertEqual(self.mock_branch.call_args[0][1], 'release/1.2.5')
        self.failUnless(self.mock_commit.called)
        self.assertEqual(self.mock_commit.call_args[0][2], False)
        self.assertEqual(self.mock_commit.call_args[0][3], 'cirrus.conf')
Example #2
0
    def test_new_nightly_release(self, mock_dt, mock_unstaged):
        """
        _test_new_release_

        """
        mock_ts = mock.Mock()
        mock_ts.strftime = mock.Mock(return_value="TIMESTAMP")
        mock_now = mock.Mock(return_value=mock_ts)
        mock_dt.datetime=mock.Mock()
        mock_dt.datetime.now = mock_now
        mock_unstaged.return_value = False
        opts = mock.Mock()
        opts.micro = False
        opts.major = False
        opts.minor = False
        opts.nightly = True
        opts.bump = None
        opts.skip_existing = False

        # should create a new minor release, editing
        # the cirrus config in the test dir
        new_release(opts)

        # verify new version
        new_conf = Configuration(self.config)
        new_conf.load()
        self.assertEqual(new_conf.package_version(), '1.2.3-nightly-TIMESTAMP')

        self.failUnless(self.mock_pull.called)
        self.assertEqual(self.mock_pull.call_args[0][1], 'develop')
        self.failUnless(self.mock_branch.called)
        self.assertEqual(self.mock_branch.call_args[0][1], 'release/1.2.3-nightly-TIMESTAMP')
        self.failUnless(self.mock_commit.called)
        self.assertEqual(self.mock_commit.call_args[0][2], False)
        self.assertEqual(self.mock_commit.call_args[0][3], 'cirrus.conf')
Example #3
0
    def test_new_release_bump(self, mock_bump, mock_unstaged):
        """
        _test_new_release_

        """
        mock_unstaged.return_value = False
        opts = mock.Mock()
        opts.micro = True
        opts.major = False
        opts.minor = False
        opts.nightly = False
        opts.bump = [['womp', '1.2.3'], ['wibble', '3.4.5']]

        # should create a new minor release, editing
        # the cirrus config in the test dir
        new_release(opts)

        # verify new version
        new_conf = Configuration(self.config)
        new_conf.load()
        self.assertEqual(new_conf.package_version(), '1.2.4')

        self.failUnless(self.mock_pull.called)
        self.assertEqual(self.mock_pull.call_args[0][1], 'develop')
        self.failUnless(self.mock_branch.called)
        self.assertEqual(self.mock_branch.call_args[0][1], 'release/1.2.4')
        self.failUnless(self.mock_commit.called)
        self.assertEqual(self.mock_commit.call_args[0][2], False)
        self.assertEqual(self.mock_commit.call_args[0][3], 'cirrus.conf')

        self.assertEqual(mock_bump.call_count, 2)
Example #4
0
    def test_new_nightly_release(self, mock_dt, mock_unstaged):
        """
        _test_new_release_

        """
        mock_ts = mock.Mock()
        mock_ts.strftime = mock.Mock(return_value="TIMESTAMP")
        mock_now = mock.Mock(return_value=mock_ts)
        mock_dt.datetime = mock.Mock()
        mock_dt.datetime.now = mock_now
        mock_unstaged.return_value = False
        opts = mock.Mock()
        opts.micro = False
        opts.major = False
        opts.minor = False
        opts.nightly = True
        opts.bump = None

        # should create a new minor release, editing
        # the cirrus config in the test dir
        new_release(opts)

        # verify new version
        new_conf = Configuration(self.config)
        new_conf.load()
        self.assertEqual(new_conf.package_version(), '1.2.3-nightly-TIMESTAMP')

        self.failUnless(self.mock_pull.called)
        self.assertEqual(self.mock_pull.call_args[0][1], 'develop')
        self.failUnless(self.mock_branch.called)
        self.assertEqual(self.mock_branch.call_args[0][1],
                         'release/1.2.3-nightly-TIMESTAMP')
        self.failUnless(self.mock_commit.called)
        self.assertEqual(self.mock_commit.call_args[0][2], False)
        self.assertEqual(self.mock_commit.call_args[0][3], 'cirrus.conf')
Example #5
0
    def test_new_release_skip_existing(self, mock_unmerged, mock_unstaged):
        """
        _test_new_release_

        """
        mock_unstaged.return_value = False
        mock_unmerged.return_value = ['1.2.4']
        opts = mock.Mock()
        opts.micro = True
        opts.major = False
        opts.minor = False
        opts.nightly = False
        opts.bump = None
        opts.skip_existing = True

        # should create a new minor release, editing
        # the cirrus config in the test dir
        new_release(opts)

        # verify new version
        new_conf = Configuration(self.config)
        new_conf.load()
        self.assertEqual(new_conf.package_version(), '1.2.5')

        self.failUnless(self.mock_pull.called)
        self.assertEqual(self.mock_pull.call_args[0][1], 'develop')
        self.failUnless(self.mock_branch.called)
        self.assertEqual(self.mock_branch.call_args[0][1], 'release/1.2.5')
        self.failUnless(self.mock_commit.called)
        self.assertEqual(self.mock_commit.call_args[0][2], False)
        self.assertEqual(self.mock_commit.call_args[0][3], 'cirrus.conf')