mirror of
https://github.com/certbot/certbot.git
synced 2026-08-02 19:42:02 +02:00
Merge pull request #227 from ThomasWaldmann/check-mode
add mode checking to 2 unit tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
"""Tests for letsencrypt.client.le_util."""
|
"""Tests for letsencrypt.client.le_util."""
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import stat
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@@ -33,11 +34,11 @@ class MakeOrVerifyDirTest(unittest.TestCase):
|
|||||||
path = os.path.join(self.root_path, 'bar')
|
path = os.path.join(self.root_path, 'bar')
|
||||||
self._call(path, 0o650)
|
self._call(path, 0o650)
|
||||||
self.assertTrue(os.path.isdir(path))
|
self.assertTrue(os.path.isdir(path))
|
||||||
# TODO: check mode
|
self.assertEqual(stat.S_IMODE(os.stat(path).st_mode), 0o650)
|
||||||
|
|
||||||
def test_existing_correct_mode_does_not_fail(self):
|
def test_existing_correct_mode_does_not_fail(self):
|
||||||
self._call(self.path, 0o400)
|
self._call(self.path, 0o400)
|
||||||
# TODO: check mode
|
self.assertEqual(stat.S_IMODE(os.stat(self.path).st_mode), 0o400)
|
||||||
|
|
||||||
def test_existing_wrong_mode_fails(self):
|
def test_existing_wrong_mode_fails(self):
|
||||||
self.assertRaises(Exception, self._call, self.path, 0o600)
|
self.assertRaises(Exception, self._call, self.path, 0o600)
|
||||||
|
|||||||
Reference in New Issue
Block a user