(self)
| 1035 | ) |
| 1036 | |
| 1037 | def test_basic(self): |
| 1038 | kwargs = dict( |
| 1039 | extensions="", outputsubfolder="", numberofrules=5, skipstatichosts=True, nounifiedhosts=False |
| 1040 | ) |
| 1041 | write_opening_header(self.final_file, **kwargs) |
| 1042 | |
| 1043 | contents = self.final_file.getvalue() |
| 1044 | contents = contents.decode("UTF-8") |
| 1045 | |
| 1046 | # Expected contents. |
| 1047 | for expected in ( |
| 1048 | "# This hosts file is a merged collection", |
| 1049 | "# with a dash of crowd sourcing via GitHub", |
| 1050 | "# Number of unique domains: {count}".format(count=kwargs["numberofrules"]), |
| 1051 | "Fetch the latest version of this file:", |
| 1052 | "Project home page: https://github.com/StevenBlack/hosts", |
| 1053 | ): |
| 1054 | self.assertIn(expected, contents) |
| 1055 | |
| 1056 | # Expected non-contents. |
| 1057 | for expected in ( |
| 1058 | "# Extensions added to this file:", |
| 1059 | "127.0.0.1 localhost", |
| 1060 | "127.0.0.1 local", |
| 1061 | "127.0.0.53", |
| 1062 | "127.0.1.1", |
| 1063 | ): |
| 1064 | self.assertNotIn(expected, contents) |
| 1065 | |
| 1066 | def test_basic_include_static_hosts(self): |
| 1067 | kwargs = dict( |
nothing calls this directly
no test coverage detected