|
|
@@ -33,26 +33,57 @@ def delete_test_site_at_user(): |
|
|
|
|
|
|
|
@raises(HydeException) |
|
|
|
@with_setup(create_test_site, delete_test_site) |
|
|
|
def test_ensure_exception_when_sitepath_exists(): |
|
|
|
e = Engine() |
|
|
|
def test_ensure_exception_when_site_yaml_exists(): |
|
|
|
e = Engine(raise_exceptions=True) |
|
|
|
File(TEST_SITE.child('site.yaml')).write("Hey") |
|
|
|
e.run(e.parse(['-s', str(TEST_SITE), 'create'])) |
|
|
|
|
|
|
|
@raises(HydeException) |
|
|
|
@with_setup(create_test_site, delete_test_site) |
|
|
|
def test_ensure_exception_when_content_folder_exists(): |
|
|
|
e = Engine(raise_exceptions=True) |
|
|
|
TEST_SITE.child_folder('content').make() |
|
|
|
e.run(e.parse(['-s', str(TEST_SITE), 'create'])) |
|
|
|
|
|
|
|
@raises(HydeException) |
|
|
|
@with_setup(create_test_site, delete_test_site) |
|
|
|
def test_ensure_exception_when_layout_folder_exists(): |
|
|
|
e = Engine(raise_exceptions=True) |
|
|
|
TEST_SITE.child_folder('layout').make() |
|
|
|
e.run(e.parse(['-s', str(TEST_SITE), 'create'])) |
|
|
|
|
|
|
|
@with_setup(create_test_site, delete_test_site) |
|
|
|
def test_ensure_no_exception_when_empty_site_exists(): |
|
|
|
e = Engine(raise_exceptions=True) |
|
|
|
e.run(e.parse(['-s', str(TEST_SITE), 'create'])) |
|
|
|
verify_site_contents(TEST_SITE, Layout.find_layout()) |
|
|
|
|
|
|
|
@with_setup(create_test_site, delete_test_site) |
|
|
|
def test_ensure_no_exception_when_sitepath_exists_when_forced(): |
|
|
|
e = Engine() |
|
|
|
def test_ensure_no_exception_when_forced(): |
|
|
|
e = Engine(raise_exceptions=True) |
|
|
|
TEST_SITE.child_folder('layout').make() |
|
|
|
e.run(e.parse(['-s', str(TEST_SITE), 'create', '-f'])) |
|
|
|
verify_site_contents(TEST_SITE, Layout.find_layout()) |
|
|
|
TEST_SITE.delete() |
|
|
|
TEST_SITE.child_folder('content').make() |
|
|
|
e.run(e.parse(['-s', str(TEST_SITE), 'create', '-f'])) |
|
|
|
assert True #No Exception |
|
|
|
verify_site_contents(TEST_SITE, Layout.find_layout()) |
|
|
|
TEST_SITE.delete() |
|
|
|
TEST_SITE.make() |
|
|
|
File(TEST_SITE.child('site.yaml')).write("Hey") |
|
|
|
e.run(e.parse(['-s', str(TEST_SITE), 'create', '-f'])) |
|
|
|
verify_site_contents(TEST_SITE, Layout.find_layout()) |
|
|
|
|
|
|
|
@with_setup(create_test_site, delete_test_site) |
|
|
|
def test_ensure_no_exception_when_sitepath_does_not_exist(): |
|
|
|
e = Engine() |
|
|
|
e = Engine(raise_exceptions=True) |
|
|
|
TEST_SITE.delete() |
|
|
|
e.run(e.parse(['-s', str(TEST_SITE), 'create', '-f'])) |
|
|
|
verify_site_contents(TEST_SITE, Layout.find_layout()) |
|
|
|
|
|
|
|
@with_setup(create_test_site_at_user, delete_test_site_at_user) |
|
|
|
def test_ensure_can_create_site_at_user(): |
|
|
|
e = Engine() |
|
|
|
e = Engine(raise_exceptions=True) |
|
|
|
TEST_SITE_AT_USER.delete() |
|
|
|
e.run(e.parse(['-s', str(TEST_SITE_AT_USER), 'create', '-f'])) |
|
|
|
verify_site_contents(TEST_SITE_AT_USER, Layout.find_layout()) |
|
|
@@ -75,6 +106,6 @@ def verify_site_contents(site, layout): |
|
|
|
@raises(HydeException) |
|
|
|
@with_setup(create_test_site, delete_test_site) |
|
|
|
def test_ensure_exception_when_layout_is_invalid(): |
|
|
|
e = Engine() |
|
|
|
e = Engine(raise_exceptions=True) |
|
|
|
e.run(e.parse(['-s', str(TEST_SITE), 'create', '-l', 'junk'])) |
|
|
|
|