Disallow to change mode for default_data.json

From time to time default_data.json gets +x mode - block
this with the test!

Change-Id: I505a72d858229014d42da96ea281b6134f5042ad
This commit is contained in:
Ilya Shakhat
2016-05-25 18:45:36 +03:00
parent a671763b6e
commit 2c3597f009
2 changed files with 10 additions and 0 deletions

0
etc/default_data.json Executable file → Normal file
View File

View File

@@ -15,6 +15,8 @@
import functools
import json
import os
import stat
import jsonschema
import six
@@ -227,3 +229,11 @@ class TestConfigFiles(testtools.TestCase):
def test_test_default_data_user_companies(self):
self._validate_user_companies('etc/test_default_data.json')
def test_file_mode(self):
files = os.listdir('etc')
for f in ('etc/%s' % f for f in files):
st = os.stat(f)
x_flag = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
self.assertFalse(bool(st.st_mode & x_flag),
msg='File %s should not be executable' % f)