Пример #1
0
    def test_add(self):
        path = "/etc/nginx/sites-enabled/example.com.conf"
        add_static("example.com")
        self.assertFalse(os.path.exists(path))
        enable("example.com")

        self.assertTrue(os.path.exists(path))
Пример #2
0
 def test_short_and(self):
     conf = "/etc/nginx/sites-available/a.conf"
     html = "/html/a/index.html"
     self.assertFalse(os.path.exists(conf))
     self.assertFalse(os.path.exists(html))
     add_static("a")
     self.assertTrue(os.path.exists(conf))
     self.assertTrue(os.path.exists(html))
Пример #3
0
 def test_long_and(self):
     conf = "/etc/nginx/sites-available/asonetuhasonetuhasonetuh.conf"
     html = "/html/asonetuhasonetuhasonetuh/index.html"
     self.assertFalse(os.path.exists(conf))
     self.assertFalse(os.path.exists(html))
     add_static("asonetuhasonetuhasonetuh")
     self.assertTrue(os.path.exists(conf))
     self.assertTrue(os.path.exists(html))
Пример #4
0
 def test_already_exists(self):
     conf = "/etc/nginx/sites-available/a.conf"
     html = "/html/a/index.html"
     self.assertFalse(os.path.exists(conf))
     self.assertFalse(os.path.exists(html))
     self.assertEqual(add_static("a"), "OK")
     self.assertEqual(add_static("a"), "ERROR")
     self.assertTrue(os.path.exists(conf))
     self.assertTrue(os.path.exists(html))
Пример #5
0
    def test_add(self):
        conf = "/etc/nginx/sites-available/example.com.conf"
        html = "/html/example.com/index.html"
        self.assertFalse(os.path.exists(conf))
        self.assertFalse(os.path.exists(html))

        add_static("example.com")

        self.assertTrue(os.path.exists(conf))
        self.assertTrue(os.path.exists(html))
Пример #6
0
 def test_two_add(self):
     conf1 = "/etc/nginx/sites-available/example.com.conf"
     html1 = "/html/example.com/index.html"
     conf2 = "/etc/nginx/sites-available/test.com.conf"
     html2 = "/html/test.com/index.html"
     self.assertFalse(os.path.exists(conf1))
     self.assertFalse(os.path.exists(html1))
     self.assertFalse(os.path.exists(conf2))
     self.assertFalse(os.path.exists(html2))
     add_static("example.com")
     add_static("test.com")
     self.assertTrue(os.path.exists(conf1))
     self.assertTrue(os.path.exists(html1))
     self.assertTrue(os.path.exists(conf2))
     self.assertTrue(os.path.exists(html2))
Пример #7
0
 def test_short_add(self):
     path = "/etc/nginx/sites-enabled/a.conf"
     add_static("a")
     self.assertFalse(os.path.exists(path))
     enable("a")
     self.assertTrue(os.path.exists(path))
Пример #8
0
 def test_long_add(self):
     path = "/etc/nginx/sites-enabled/asonetuhasonetuhasonetuh.conf"
     add_static("asonetuhasonetuhasonetuh")
     self.assertFalse(os.path.exists(path))
     enable("asonetuhasonetuhasonetuh")
     self.assertTrue(os.path.exists(path))