diff --git a/test/__init__.py b/test/__init__.py index 315fc88..53db34a 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -1,6 +1,7 @@ -import unittest, json, decimal +import unittest, json, decimal, os from smtpapi import SMTPAPIHeader + class TestSMTPAPI(unittest.TestCase): def setUp(self): @@ -72,5 +73,41 @@ def test_drop_empty(self): self.assertEqual(self.dropsHeader, json.loads(header.json_string())) +class TestRepository(unittest.TestCase): + + def setUp(self): + + self.required_files = [ + ['./Dockerfile', './docker/Dockerfile'], + ['./docker-compose.yml', './docker/docker-compose.yml'], + './.codeclimate.yml', + './.env_sample', + './.github/ISSUE_TEMPLATE', + './.github/PULL_REQUEST_TEMPLATE', + './.gitignore', + './.travis.yml', + './CHANGELOG.md', + './CODE_OF_CONDUCT.md', + './CONTRIBUTING.md', + ['./LICENSE.md', './License.txt'], + './README.md', + './TROUBLESHOOTING.md', + './USAGE.md', + './USE_CASES.md', + ] + + self.file_not_found_message = 'File "{0}" does not exist in repo!' + + def test_repository_files_exists(self): + + for file_path in self.required_files: + if isinstance(file_path, list): + # multiple file paths: assert that any one of the files exists + self.assertTrue(any(os.path.exists(f) for f in file_path), + msg=self.file_not_found_message.format('" or "'.join(file_path))) + else: + self.assertTrue(os.path.exists(file_path), msg=self.file_not_found_message.format(file_path)) + + if __name__ == '__main__': unittest.main()