Feat: add flux in dataplatform
This commit is contained in:
@@ -4,6 +4,8 @@ from pathlib import Path
|
||||
import pytest
|
||||
|
||||
from plesna.dataplatform import DataPlateform
|
||||
from plesna.models.flux import Flux
|
||||
from plesna.models.transformation import Transformation
|
||||
from plesna.storage.repository.fs_repository import FSRepository
|
||||
|
||||
FIXTURE_DIR = Path(__file__).parent.parent / Path("raw_datas")
|
||||
@@ -69,6 +71,29 @@ def test_listing_content(dataplatform: DataPlateform):
|
||||
]
|
||||
|
||||
|
||||
def test_add_flux(dataplatform: DataPlateform):
|
||||
# dataplatform.add_flux()
|
||||
pass
|
||||
@pytest.fixture
|
||||
def copy_flux(repository: FSRepository) -> Flux:
|
||||
src = {"username": repository.table("raw", "username")}
|
||||
targets = {"username": repository.table("bronze", "username")}
|
||||
|
||||
def copy(sources, targets):
|
||||
pass
|
||||
|
||||
extra_kwrds = {}
|
||||
|
||||
flux = Flux(
|
||||
sources=src,
|
||||
targets=targets,
|
||||
transformation=Transformation(function=copy, extra_kwrds=extra_kwrds),
|
||||
)
|
||||
return flux
|
||||
|
||||
|
||||
def test_add_flux(dataplatform: DataPlateform, copy_flux: Flux):
|
||||
dataplatform.add_flux(name="copy_flux", flux=copy_flux)
|
||||
assert dataplatform.fluxes == ["copy_flux"]
|
||||
dataplatform.add_flux(name="copy_flux_bis", flux=copy_flux)
|
||||
assert dataplatform.fluxes == ["copy_flux", "copy_flux_bis"]
|
||||
|
||||
assert dataplatform.flux("copy_flux") == copy_flux
|
||||
assert dataplatform.flux("copy_flux_bis") == copy_flux
|
||||
|
||||
Reference in New Issue
Block a user