Skip to content

Adds test for repo files #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions tests/test_repofiles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from os import path
try:
import unittest2 as unittest
except ImportError:
import unittest


class RepoFiles(unittest.TestCase):
FILES = [
['./Dockerfile', './docker/Dockerfile'],
['./docker-compose.yml', './docker/docker-compose.yml'],
['./.env_sample'],
['./.gitignore'],
['./.travis.yml'],
['./.codeclimate.yml'],
['./CHANGELOG.md'],
['./CODE_OF_CONDUCT.md'],
['./CONTRIBUTING.md'],
['./.github/ISSUE_TEMPLATE'],
['./LICENSE.md', './LICENSE.txt'],
['./.github/PULL_REQUEST_TEMPLATE'],
['./README.md'],
['./TROUBLESHOOTING.md'],
['./USAGE.md'],
['./USE_CASES.md']
]

def _all_file(self, files):
'''
Checks the list of files and sees if they exist. If all of them don't
exist, returns False. Otherwise, return True.
'''
return all(map(lambda f: not path.isfile(f), files))

def test_file_existance(self):
missing = list(filter(self._all_file, self.FILES))
self.assertTrue(len(missing) == 0,
"Files %s aren't found" % str(missing))