Пример #1
0
 def test_replaces_maas_configuration(self):
     ntp_maas_conf_path = factory.make_name(config._ntp_maas_conf_name)
     ntp_conf_lines = config._render_ntp_conf_from_source(
         example_ntp_conf.splitlines(keepends=True), ntp_maas_conf_path)
     ntp_conf_lines = config._render_ntp_conf_from_source(
         ntp_conf_lines, ntp_maas_conf_path)
     included_files = extract_included_files("".join(ntp_conf_lines))
     self.assertThat(included_files, Equals([ntp_maas_conf_path]))
Пример #2
0
 def test_cleans_up_whitespace(self):
     ntp_conf_lines = [
         "# chrony.conf\n",
         "\n",
         "   \n",
         "\t\r\n",
         "foo",
         "bar",
         "\n",
         "\n",
     ]
     ntp_maas_conf_path = factory.make_name(config._ntp_maas_conf_name)
     ntp_conf_lines = config._render_ntp_conf_from_source(
         ntp_conf_lines, ntp_maas_conf_path)
     self.assertThat(
         list(ntp_conf_lines),
         Equals([
             "# chrony.conf\n",
             "\n",
             "foo",
             "bar",
             "\n",
             "include %s\n" % ntp_maas_conf_path,
         ]),
     )
Пример #3
0
 def test_removes_pools_and_servers_from_source_configuration(self):
     ntp_maas_conf_path = factory.make_name(config._ntp_maas_conf_name)
     ntp_conf_lines = config._render_ntp_conf_from_source(
         example_ntp_conf.splitlines(keepends=True), ntp_maas_conf_path
     )
     servers_or_pools = extract_servers_and_pools("".join(ntp_conf_lines))
     self.assertThat(servers_or_pools, Equals([]))