예제 #1
0
 def test_non_exist_file(self):
     """
     case specified value as following:
     /var/log/blackbird.log
     * blackbird.log does not exists.
         + This means often the first-time execution of blackbird.
     * /var/log(directory) exists.
     """
     value = os.path.join(os.path.dirname(__file__), self.log_name)
     eq_(configread.is_log(value), value)
예제 #2
0
 def test_exist_dir(self):
     """
     case specified value as following:
     /tmp
     * specified value is directory.
     * execution user has write permission.
     """
     check_value = os.path.dirname(__file__)
     eq_(configread.is_log(check_value),
         os.path.join(check_value, self.log_name))
예제 #3
0
 def test_non_exist_dir_with_file(self):
     """
     case specified value as following:
     /blackbird/blackbird.log
     * /blackbird/blackbird.log does not exists.
     * /blackbird does not exists, too.
     """
     check_value = os.path.join(self.tmp_dir, 'NotExistsDirectory',
                                self.log_name)
     ok_(configread.is_log(check_value))
예제 #4
0
 def test_exist_file(self):
     """
     case specified value as following:
     /var/log/blackbird/blackbird.log
     * specified file exists.
     * execution user has write permission.
     """
     log_file = tempfile.NamedTemporaryFile(dir=self.tmp_dir)
     check_value = log_file.name
     eq_(configread.is_log(check_value), check_value)
예제 #5
0
    def test_cannot_write_dir(self):
        """
        case specified value as following:
        /var/log
        * specified value is directory.
        * execution user does not have write permission.
        """
        log_dir = os.path.join(self.tmp_dir, 'CannotReadDirectory')
        os.mkdir(log_dir, 0000)

        ok_(configread.is_log(log_dir))
예제 #6
0
 def test_cannot_write_file(self):
     """
     case specified value as following:
     /var/log/messages
     * specified file exists.
     * execution doesn't have write permission.
     """
     log_file = tempfile.NamedTemporaryFile(dir=self.tmp_dir)
     check_value = log_file.name
     os.chmod(check_value, 0000)
     ok_(configread.is_log(check_value))
예제 #7
0
 def test_assume_file_to_dir(self):
     """
     case specified value as following:
     /var/log/messages/blackbird.log
     * /var/log/messages exists.
     * But, /var/log/messages is the file.
         + This means following...
             - If specified value does not exists, check upper directory.
     """
     log_dir = tempfile.NamedTemporaryFile(dir=self.tmp_dir)
     check_value = os.path.join(log_dir.name, self.log_name)
     ok_(configread.is_log(check_value))
예제 #8
0
    def test_cannot_write_upper_dir(self):
        """
        case specified value as following:
        /root/blackbird.log
        * blackbird.log does not exists.
        * /root exists
            + But, execution user doesn't have write permission.
        """
        log_dir = os.path.join(self.tmp_dir, 'CannotReadDirectory')
        os.mkdir(log_dir, 0000)
        check_value = os.path.join(log_dir, self.log_name)

        ok_(configread.is_log(check_value))