Esempio n. 1
0
def test_end_scene_success(setup, create_one_scene, scene_root, history_db,
                           current_scene_db):
    from src.praxxis.scene import end_scene
    from tests.src.praxxis.util import dummy_object
    name1 = dummy_object.make_dummy_scene("generated_one_scene")

    message = end_scene.end_scene(name1, scene_root, history_db,
                                  current_scene_db)
    assert message == "generated_one_scene"
Esempio n. 2
0
def test_change_scene(setup, create_one_scene, scene_root, history_db):
    from src.praxxis.scene import current_scene

    scene = dummy_object.make_dummy_scene("scene")

    entry_scene.change_scene(scene, scene_root, history_db)
    current_scene = current_scene.current_scene(scene_root, history_db)

    assert current_scene == "scene"
Esempio n. 3
0
def create_many_scenes(scene_root, history_db, current_scene_db):
    from src.praxxis.scene import new_scene
    from src.praxxis.scene import delete_scene
    from tests.src.praxxis.util import dummy_object
    from src.praxxis.util import error

    name1 = dummy_object.make_dummy_scene("generated_scene_1")

    name2 = dummy_object.make_dummy_scene("generated_scene_2")

    new_scene.new_scene(name1, scene_root, history_db)
    new_scene.new_scene(name2, scene_root, history_db)
    yield
    try:
        delete_scene.delete_scene(name1, scene_root, history_db)
        delete_scene.delete_scene(name2, scene_root, history_db)
    except error.SceneNotFoundError:
        pass
Esempio n. 4
0
def test_end_scene_failure(setup, scene_root, history_db, current_scene_db):
    from src.praxxis.scene import end_scene
    from tests.src.praxxis.util import dummy_object
    from src.praxxis.util import error
    from src.praxxis.display import display_error

    name1 = dummy_object.make_dummy_scene("nonexistent_scene")

    try:
        end_scene.end_scene(name1, scene_root, history_db, current_scene_db)
    except error.SceneNotFoundError as e:
        assert str(e) == display_error.scene_not_found_error(name1.name)
Esempio n. 5
0
def test_new_scene(setup, scene_root, history_db):
    from src.praxxis.scene import delete_scene
    from src.praxxis.scene import current_scene

    scene = dummy_object.make_dummy_scene("generated_new_scene")

    entry_scene.new_scene(scene, scene_root, history_db)
    current_scene = current_scene.current_scene(scene_root, history_db)

    assert current_scene == "generated_new_scene"

    delete_scene.delete_scene("generated_new_scene", scene_root, history_db)
Esempio n. 6
0
def test_end_scene_ended(setup, scene_root, history_db, current_scene_db,
                         create_ended_scene):
    from src.praxxis.scene import end_scene
    from tests.src.praxxis.util import dummy_object
    from src.praxxis.util import error
    from src.praxxis.display import display_error

    name1 = dummy_object.make_dummy_scene("generated_ended_scene")

    try:
        end_scene.end_scene(name1, scene_root, history_db, current_scene_db)
    except error.EndEndedSceneError as e:
        assert str(e) == display_error.end_ended_scene_error(name1.name)
Esempio n. 7
0
def test_end_scene_last_active(setup, scene_root, history_db,
                               current_scene_db):
    from src.praxxis.scene import end_scene
    from tests.src.praxxis.util import dummy_object
    from src.praxxis.util import error
    from src.praxxis.display import display_error

    name1 = dummy_object.make_dummy_scene("scene")

    try:
        end_scene.end_scene(name1, scene_root, history_db, current_scene_db)
        assert 0
    except error.LastActiveSceneError as e:
        assert str(e) == display_error.last_active_scene_error(name1.name)
Esempio n. 8
0
def create_ended_scene(scene_root, history_db, current_scene_db):
    from src.praxxis.scene import new_scene
    from src.praxxis.scene import delete_scene
    from src.praxxis.scene import end_scene
    from tests.src.praxxis.util import dummy_object
    from src.praxxis.util import error
    from src.praxxis.display import display_error

    name1 = dummy_object.make_dummy_scene("generated_ended_scene")
    new_scene.new_scene(name1, scene_root, history_db)
    end_scene.end_scene(name1, scene_root, history_db, current_scene_db)
    yield
    try:
        delete_scene.delete_scene(name1, scene_root, history_db)
    except error.SceneNotFoundError:
        pass