コード例 #1
0
    def test_exists_with_wrong_perms(self, mock_stderr, mock_expanduser):
        mock_expanduser.return_value = self.pulppath
        os.mkdir(self.pulppath, 0755)

        launcher.ensure_user_pulp_dir()

        self.assertEqual(mock_stderr.write.call_count, 1)
        message = mock_stderr.write.call_args[0][0]
        # make sure it prints a warning to stderr
        self.assertTrue(message.startswith('Warning:'))
コード例 #2
0
ファイル: test_launcher.py プロジェクト: alanoe/pulp
    def test_does_not_exist(self, mock_expanduser):
        mock_expanduser.return_value = self.pulppath

        launcher.ensure_user_pulp_dir()

        stats = os.stat(os.path.join(self.workingdir, '.pulp'))
        actual_mode = stat.S_IMODE(stats.st_mode)
        desired_mode = stat.S_IRUSR + stat.S_IWUSR + stat.S_IXUSR

        self.assertEqual(actual_mode, desired_mode)
コード例 #3
0
    def test_does_not_exist(self, mock_expanduser):
        mock_expanduser.return_value = self.pulppath

        launcher.ensure_user_pulp_dir()

        stats = os.stat(os.path.join(self.workingdir, '.pulp'))
        actual_mode = stat.S_IMODE(stats.st_mode)
        desired_mode = stat.S_IRUSR + stat.S_IWUSR + stat.S_IXUSR

        self.assertEqual(actual_mode, desired_mode)
コード例 #4
0
ファイル: test_launcher.py プロジェクト: alanoe/pulp
    def test_fail_to_create(self, mock_stderr, mock_exit, mock_mkdir, mock_expanduser):
        mock_expanduser.return_value = self.pulppath
        launcher.ensure_user_pulp_dir()

        mock_exit.assert_called_once_with(1)

        self.assertEqual(mock_stderr.write.call_count, 1)
        message = mock_stderr.write.call_args[0][0]
        # make sure it prints a warning to stderr
        self.assertTrue(message.startswith('Failed to create'))
コード例 #5
0
ファイル: test_launcher.py プロジェクト: alanoe/pulp
    def test_exists_with_wrong_perms(self, mock_stderr, mock_expanduser):
        mock_expanduser.return_value = self.pulppath
        os.mkdir(self.pulppath, 0755)

        launcher.ensure_user_pulp_dir()

        self.assertEqual(mock_stderr.write.call_count, 1)
        message = mock_stderr.write.call_args[0][0]
        # make sure it prints a warning to stderr
        self.assertTrue(message.startswith('Warning:'))
コード例 #6
0
    def test_fail_to_create(self, mock_stderr, mock_exit, mock_mkdir,
                            mock_expanduser):
        mock_expanduser.return_value = self.pulppath
        launcher.ensure_user_pulp_dir()

        mock_exit.assert_called_once_with(1)

        self.assertEqual(mock_stderr.write.call_count, 1)
        message = mock_stderr.write.call_args[0][0]
        # make sure it prints a warning to stderr
        self.assertTrue(message.startswith('Failed to create'))
コード例 #7
0
    def test_asks_for_correct_dir(self, mock_expanduser):
        mock_expanduser.return_value = self.pulppath

        launcher.ensure_user_pulp_dir()

        mock_expanduser.assert_called_once_with(constants.USER_CONFIG_DIR)
コード例 #8
0
ファイル: test_launcher.py プロジェクト: alanoe/pulp
    def test_asks_for_correct_dir(self, mock_expanduser):
        mock_expanduser.return_value = self.pulppath

        launcher.ensure_user_pulp_dir()

        mock_expanduser.assert_called_once_with(constants.USER_CONFIG_DIR)