Пример #1
0
 def test_site_toggle_does_nothing_when_site_already_enabled(self):
     """
     tests that site_toggle_up_down does nothing when site is already enabled
     :return:
     """
     self.make_site_confs("up")
     serve_django_static = ServeStatic(
         self.dist_version,
         self.app_home,
         self.log_file,
         self.log_level,
         git_repo=self.git_repo,
         nginx_conf=self.nginx_conf,
     )
     serve_django_static.site_toggle_up_down("up")
     self.log("INFO: %s is already enabled" % self.app_name)
Пример #2
0
 def test_site_toggle_exits_when_sites_available_conf_file_is_absent(self):
     """
     tests that site_toggle_up_down exits when sites available conf file is absent
     """
     self.make_site_confs("down")
     os.remove(os.path.join(self.nginx_conf, "sites-available", "%s.conf" % self.app_name))
     serve_django_static = ServeStatic(
         self.dist_version,
         self.app_home,
         self.log_file,
         self.log_level,
         git_repo=self.git_repo,
         nginx_conf=self.nginx_conf,
     )
     try:
         serve_django_static.site_toggle_up_down("up")
         self.fail("site_toggle_up_down failed to exit on file not found error")
     except SystemExit as error:
         self.assertEqual(1, error.code, "move exited with: " + str(error))
         self.log(
             "ERROR: file not found: %s"
             % os.path.join(self.nginx_conf, "sites-available", "%s.conf" % self.app_name)
         )