def setup_few_projects():
    return (
        Project("Capture Animals", "try to capture rare animals", "Jhonson"),
        Project(
            "PUBG",
            "pvp shooting game in which up 100 players fight in a battle royale",
            "Player Unknown"),
        Project(
            "MineCraft",
            "3d sandbox game which is one of the most popular game in the world",
        ))
示例#2
0
def create_project(project: Project, project_root_path: str):
    if not isinstance(project, Project):
        raise TypeError("project must be Project Object")
    if not isinstance(project_root_path, str):
        raise TypeError("project_root_path must be string")

    if not os.path.isabs(project_root_path):
        project_root_path = os.path.abspath(project_root_path)
    if not os.path.exists(project_root_path):
        raise ProjectFileSystemException("project_root_path does not exists")

    project._set_path(project_root_path)
    id = db.add(project)
    _create_dir(project, project_root_path)
    return id
import pytest
from entity_database import Project, Asset, Shot


@pytest.mark.parametrize(
    "entity, expected",
    [(Project("test_project", "This is a test project.", id=12), {
        "name": "test_project",
        "description": "This is a test project.",
        "id": 12
    }),
     (Asset("test_asset", "this is a test asset.", id=5), {
         "name": "test_asset",
         "description": "this is a test asset.",
         "id": 5
     }), (Shot("shot001", id=123), {
         "name": "shot001",
         "id": 123
     })])
def test_asdict(entity, expected):
    dict = entity._asdict()
    assert dict == expected
示例#4
0
def test_delete(entity):
    project_id = entity_database.add(entity)
    entity_database.delete(project_id)
    assert not Project.is_element(entity, entity_database.list_all())
示例#5
0
import pytest

import entity_database
from entity_database import Project, Asset, Shot

list_entities = [
    Project("aws learning", "learning aws for fun","hsuzuki"),
    Project("Firm project", "Creating Short firm by myself","urata"),
    Project("VR_r&d", "testing virtual reality tools"),
    Project("ML", "Machine learning development","steve"),
    Asset("mokuri", "main character"),
    Asset("noinoi", "sub character","hsuzuki"),
    Asset("landscape_setA", "landscape set for sequence 01","urata"),
    Asset("hammer01A", "hammer for mokuri's prop"),
    Shot("S1C010"),
    Shot("S1C020"),
    Shot("S2C030"),
]


@pytest.mark.parametrize("entity",list_entities)
def test_delete(entity):
    project_id = entity_database.add(entity)
    entity_database.delete(project_id)
    assert not Project.is_element(entity, entity_database.list_all())

def test_delete_all(db_with_3_projects):
    entity_database.delete_all()
    assert entity_database.count() == 0
    assert entity_database.list_all() == []
def test_update(project, project_updated):
    project_id = entity_database.add(project)
    entity_database.update(project_id, project_updated)
    project_resistered = entity_database.get(project_id)
    assert Project.equivalent(project_updated, project_resistered)
import pytest

import entity_database
from entity_database import Project, Asset, Shot


@pytest.mark.parametrize(("project,project_updated"), [
    (Project("VR_r&d", "testing virual reality tools"),
     Project("VR_r&d", "testing virual reality tools")),
    (Project("aws learning", "learning aws for fun", "hsuzuki"),
     Project("gcp learning", "learning gcp for fun", "hsuzuki")),
    (Asset("assetA", "",
           ""), Asset("assetA", "this is asset A", "hibiki suzuki")),
    (Shot("s01", "", ""), Shot("shot001", "this is shot 001",
                               "hibiki suzuki")),
])
def test_update(project, project_updated):
    project_id = entity_database.add(project)
    entity_database.update(project_id, project_updated)
    project_resistered = entity_database.get(project_id)
    assert Project.equivalent(project_updated, project_resistered)


id
def single_project():
    return Project("testproject", "this is a test project.", "testauthor")