コード例 #1
0
    def test_get_mock_cmd_with_consolehelper(self):
        """
        Test get_mock_cmd when /usr/bin/mock points to consolehelper
        """
        def mock_realpath(path):
            return '/usr/bin/consolehelper'

        realpath_backup = build.os.path.realpath

        build.os.path.realpath = mock_realpath

        mock_cmd = build.get_mock_cmd()

        build.os.path.realpath = realpath_backup

        self.assertEqual(mock_cmd, '/usr/bin/mock')
コード例 #2
0
    def test_get_mock_cmd_without_consolehelper(self):
        """
        Test get_mock_cmd when /usr/bin/mock doesn't point to consolehelper
        """
        def mock_realpath(path):
            return path

        realpath_backup = build.os.path.realpath

        build.os.path.realpath = mock_realpath

        mock_cmd = build.get_mock_cmd()

        build.os.path.realpath = realpath_backup

        self.assertEqual(mock_cmd, 'sudo /usr/bin/mock')