Пример #1
0
 def test_valid_url_from_path(self):
     assert WPSite.from_path(settings.OPENSHIFT_ENV, ROOT_PATH) \
         .url == "http://localhost/"
     assert WPSite.from_path(settings.OPENSHIFT_ENV, ROOT_PATH + "htdocs/folder") \
         .url == "http://localhost/folder"
     assert WPSite.from_path(settings.OPENSHIFT_ENV, ROOT_PATH + "htdocs/folder/sub") \
         .url == "http://localhost/folder/sub"
Пример #2
0
 def test_name(self, wordpress):
     assert wordpress.name == "folder"
     assert WPSite(
         openshift_env=settings.OPENSHIFT_ENV,
         wp_site_url="http://localhost/") \
         .name == "localhost"
     assert WPSite(
         openshift_env=settings.OPENSHIFT_ENV,
         wp_site_url="http://www.epfl.ch/") \
         .name == "www"
     assert WPSite.from_path(settings.OPENSHIFT_ENV, ROOT_PATH + "htdocs/folder") \
         .name == "folder"
     assert WPSite.from_path(settings.OPENSHIFT_ENV, ROOT_PATH + "htdocs/folder/sub") \
         .name == "sub"
Пример #3
0
 def test_failing_url_from_path(self):
     with pytest.raises(ValueError):
         WPSite.from_path("idontexistandneverwill", ROOT_PATH)
Пример #4
0
 def test_valid_url_from_path(self):
     assert WPSite.from_path(ROOT_PATH + "htdocs/folder") \
         .url == "https://localhost/folder"
     assert WPSite.from_path(ROOT_PATH + "htdocs/folder/sub") \
         .url == "https://localhost/folder/sub"
Пример #5
0
 def test_failing_url_from_path(self):
     with pytest.raises(ValueError):
         WPSite.from_path("/usr/folder")