def testRemovingSingleExistingHost(self):
    utils.RemoveEtcHostsEntry(self.tmpname, "localhost")

    self.assertFileContent(self.tmpname,
      "# This is a test file for /etc/hosts\n"
      "192.0.2.1 router gw\n")
    self.assertFileMode(self.tmpname, 0o644)
  def testRemovingAlias(self):
    utils.RemoveEtcHostsEntry(self.tmpname, "gw")

    self.assertFileContent(self.tmpname,
      "# This is a test file for /etc/hosts\n"
      "127.0.0.1\tlocalhost\n"
      "192.0.2.1 router\n")
    self.assertFileMode(self.tmpname, 0o644)
    def testRemovingExistingHost(self):
        utils.RemoveEtcHostsEntry(self.tmpname, "router")

        self.assertFileContent(
            self.tmpname, "# This is a test file for /etc/hosts\n"
            "127.0.0.1\tlocalhost\n"
            "192.0.2.1 gw\n")
        self.assertFileMode(self.tmpname, 0644)