Exemple #1
0
 def test_validate_overrides_when_has_password_good_permissions(self, mock_config, mock_os_stat):
     # st_mode is the file permissions component of stat output
     # st_mode = 33216 emulates a 700 permission
     mock_os_stat.return_value.st_mode = 33216
     mock_config.return_value.has_option.return_value = True
     validate_overrides('/tmp/admin.conf')
     mock_config.assert_called_once_with('/tmp/admin.conf')
Exemple #2
0
 def test_validate_overrides_when_has_password_good_permissions(
         self, mock_config, mock_os_stat):
     # st_mode is the file permissions component of stat output
     # st_mode = 33216 emulates a 700 permission
     mock_os_stat.return_value.st_mode = 33216
     mock_config.return_value.has_option.return_value = True
     validate_overrides('/tmp/admin.conf')
     mock_config.assert_called_once_with('/tmp/admin.conf')
Exemple #3
0
 def test_validate_overrides_when_does_not_have_password(self, mock_config, mock_os_stat):
     # st_mode is the file permissions component of stat output
     # st_mode = 33279 emulates a 777 permission
     mock_os_stat.return_value.st_mode = 33279
     mock_config.return_value.has_option.return_value = False
     try:
         validate_overrides('/tmp/admin.conf')
     except Exception as error:
         self.fail("validate_overrides should not raise an Exception. Raised %s" % error)
Exemple #4
0
 def test_validate_overrides_when_does_not_have_password(
         self, mock_config, mock_os_stat):
     # st_mode is the file permissions component of stat output
     # st_mode = 33279 emulates a 777 permission
     mock_os_stat.return_value.st_mode = 33279
     mock_config.return_value.has_option.return_value = False
     try:
         validate_overrides('/tmp/admin.conf')
     except Exception as error:
         self.fail(
             "validate_overrides should not raise an Exception. Raised %s" %
             error)