|
1 | | -import unittest, json, decimal |
| 1 | +import unittest, json, decimal, os |
2 | 2 | from smtpapi import SMTPAPIHeader |
3 | 3 |
|
| 4 | + |
4 | 5 | class TestSMTPAPI(unittest.TestCase): |
5 | 6 |
|
6 | 7 | def setUp(self): |
@@ -72,5 +73,41 @@ def test_drop_empty(self): |
72 | 73 | self.assertEqual(self.dropsHeader, json.loads(header.json_string())) |
73 | 74 |
|
74 | 75 |
|
| 76 | +class TestRepository(unittest.TestCase): |
| 77 | + |
| 78 | + def setUp(self): |
| 79 | + |
| 80 | + self.required_files = [ |
| 81 | + ['./Dockerfile', './docker/Dockerfile'], |
| 82 | + ['./docker-compose.yml', './docker/docker-compose.yml'], |
| 83 | + './.codeclimate.yml', |
| 84 | + './.env_sample', |
| 85 | + './.github/ISSUE_TEMPLATE', |
| 86 | + './.github/PULL_REQUEST_TEMPLATE', |
| 87 | + './.gitignore', |
| 88 | + './.travis.yml', |
| 89 | + './CHANGELOG.md', |
| 90 | + './CODE_OF_CONDUCT.md', |
| 91 | + './CONTRIBUTING.md', |
| 92 | + ['./LICENSE.md', './License.txt'], |
| 93 | + './README.md', |
| 94 | + './TROUBLESHOOTING.md', |
| 95 | + './USAGE.md', |
| 96 | + './USE_CASES.md', |
| 97 | + ] |
| 98 | + |
| 99 | + self.file_not_found_message = 'File "{0}" does not exist in repo!' |
| 100 | + |
| 101 | + def test_repository_files_exists(self): |
| 102 | + |
| 103 | + for file_path in self.required_files: |
| 104 | + if isinstance(file_path, list): |
| 105 | + # multiple file paths: assert that any one of the files exists |
| 106 | + self.assertTrue(any(os.path.exists(f) for f in file_path), |
| 107 | + msg=self.file_not_found_message.format('" or "'.join(file_path))) |
| 108 | + else: |
| 109 | + self.assertTrue(os.path.exists(file_path), msg=self.file_not_found_message.format(file_path)) |
| 110 | + |
| 111 | + |
75 | 112 | if __name__ == '__main__': |
76 | 113 | unittest.main() |
0 commit comments