Skip to content

Commit c2243fd

Browse files
author
Matt Bernier
authored
Merge pull request #60 from cheukyin699/files-test
Adds test for repo files
2 parents e68e64c + 4eb71c4 commit c2243fd

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/test_repofiles.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from os import path
2+
try:
3+
import unittest2 as unittest
4+
except ImportError:
5+
import unittest
6+
7+
8+
class RepoFiles(unittest.TestCase):
9+
FILES = [
10+
['./Dockerfile', './docker/Dockerfile'],
11+
['./docker-compose.yml', './docker/docker-compose.yml'],
12+
['./.env_sample'],
13+
['./.gitignore'],
14+
['./.travis.yml'],
15+
['./.codeclimate.yml'],
16+
['./CHANGELOG.md'],
17+
['./CODE_OF_CONDUCT.md'],
18+
['./CONTRIBUTING.md'],
19+
['./.github/ISSUE_TEMPLATE'],
20+
['./LICENSE.md', './LICENSE.txt'],
21+
['./.github/PULL_REQUEST_TEMPLATE'],
22+
['./README.md'],
23+
['./TROUBLESHOOTING.md'],
24+
['./USAGE.md'],
25+
['./USE_CASES.md']
26+
]
27+
28+
def _all_file(self, files):
29+
'''
30+
Checks the list of files and sees if they exist. If all of them don't
31+
exist, returns False. Otherwise, return True.
32+
'''
33+
return all(map(lambda f: not path.isfile(f), files))
34+
35+
def test_file_existance(self):
36+
missing = list(filter(self._all_file, self.FILES))
37+
self.assertTrue(len(missing) == 0,
38+
"Files %s aren't found" % str(missing))

0 commit comments

Comments
 (0)