grai_schemas
v1
mock

DefaultValueFactory Objects

class DefaultValueFactory(ModelFactory[DefaultValue])

data_type

@post_generated
@classmethod
def data_type(cls, default_value) -> Optional[str]

NamedNodeSpecFactory Objects

class NamedNodeSpecFactory(ModelFactory[NamedSpec])

metadata

@post_generated
@classmethod
def metadata(cls, data_sources: List[SourceSpec]) -> NodeMetadataV1

is_active

@post_generated
@classmethod
def is_active(cls, data_sources: List[SourceSpec]) -> bool

MockNode Objects

class MockNode()

A class for generating mock nodes for testing.

Attributes:

  • workspace - The workspace to associate with the mock nodes.
  • kwargs - Additional keyword arguments to pass to the factories.

__init__

def __init__(workspace: Optional[WorkspaceSpec] = None,
             data_source: Optional[SourceSpec] = None,
             data_sources: Optional[List[SourceSpec]] = None,
             **kwargs)

Initializes the MockNode class.

Arguments:

  • workspace - The workspace to associate with the mock nodes.
  • kwargs - Additional keyword arguments to pass to the factories.

node

def node(**kwargs) -> NodeV1

Generates a mocked NodeV1 object.

named_node_spec

def named_node_spec(**kwargs) -> NamedSpec

Generates a mocked NamedSpec object.

id_node_spec

def id_node_spec(**kwargs) -> IDSpec

Generates a mocked IDSpec object.

sourced_node

def sourced_node(**kwargs) -> SourcedNodeV1

Generates a mocked SourcedNodeV1 object.

named_source_node_spec

def named_source_node_spec(**kwargs) -> NamedSourceSpec

Generates a mocked NamedSourceSpec object.

id_source_node_spec

def id_source_node_spec(**kwargs) -> IDSourceSpec

Generates a mocked IDSourceSpec object.

NamedEdgeSpecFactory Objects

class NamedEdgeSpecFactory(ModelFactory[NamedEdgeSpec])

metadata

@post_generated
@classmethod
def metadata(cls, data_sources: List[SourceSpec]) -> EdgeMetadataV1

is_active

@post_generated
@classmethod
def is_active(cls, data_sources: List[SourceSpec]) -> bool

MockEdge Objects

class MockEdge()

A class for generating mock edges for testing.

Attributes:

  • workspace - The workspace to associate with the mock edges.

sourced_edge

def sourced_edge(**kwargs) -> SourcedEdgeV1

Generates a mocked SourcedEdgeV1 object.

edge

def edge(**kwargs) -> EdgeV1

Generates a mocked EdgeV1 object.

named_edge_spec

def named_edge_spec(**kwargs) -> NamedEdgeSpec

Generates a mocked NamedEdgeSpec object.

id_edge_spec

def id_edge_spec(**kwargs) -> EdgeIDSpec

Generates a mocked EdgeIDSpec object.

named_source_edge_spec

def named_source_edge_spec(**kwargs) -> NamedEdgeSourceSpec

Generates a mocked NamedEdgeSourceSpec object.

id_source_edge_spec

def id_source_edge_spec(**kwargs) -> EdgeIDSourceSpec

Generates a mocked EdgeIDSourceSpec object.

MockOrganisation Objects

class MockOrganisation()

A class for generating mock organisations for testing.

organisation

@classmethod
def organisation(cls, **kwargs) -> OrganisationV1

Generate a mocked OrganisationV1 object.

organisation_spec

@classmethod
def organisation_spec(cls, **kwargs) -> OrganisationSpec

Generate a mocked OrganisationSpec object.

organization

@classmethod
def organization(cls, **kwargs) -> OrganisationV1

Generate a mocked OrganisationV1 object.

organization_spec

@classmethod
def organization_spec(cls, **kwargs) -> OrganisationSpec

Generate a mocked OrganisationSpec object.

WorkspaceSpecFactory Objects

class WorkspaceSpecFactory(ModelFactory[WorkspaceSpec])

ref

@post_generated
@classmethod
def ref(cls, name, organisation) -> str

MockWorkspace Objects

class MockWorkspace()

A class for generating mock workspaces for testing.

Attributes:

  • organisation - The organisation to associate with the mock workspaces.

__init__

def __init__(organisation=None)

Initializes the MockWorkspace class.

Arguments:

  • organisation - The organisation to associate with the mock workspaces.

workspace

def workspace(**kwargs) -> WorkspaceV1

Generates a mocked WorkspaceV1 object.

workspace_spec

def workspace_spec(**kwargs) -> WorkspaceSpec

Generates a mocked WorkspaceSpec object.

MockSource Objects

class MockSource()

A class for generating mocked source objects for testing.

Attributes:

  • workspace - The workspace to associate with the mock sources.

__init__

def __init__(workspace=None)

Initializes the MockSource class.

Arguments:

  • workspace - The workspace to associate with the mock sources.

source

def source(**kwargs) -> SourceV1

Generates a mocked SourceV1 object.

source_spec

def source_spec(**kwargs) -> SourceSpec

Generates a mocked SourceSpec object.

MockEvent Objects

class MockEvent()

A class for generating mock events for testing.

Attributes:

  • workspace - The workspace to associate with the mock events.

__init__

def __init__(workspace=None)

Initializes the MockEvent class.

Arguments:

  • workspace - The workspace to associate with the mock events.

event_spec

def event_spec(**kwargs) -> EventSpec

Generates a mocked EventSpec object.

event

def event(**kwargs) -> EventV1

Generates a mocked EventV1 object.

MockV1 Objects

class MockV1()

A class for generating mock objects for testing.

Attributes:

  • node - Mocker for Node objects
  • edge - Mocker for Edge objects
  • organisation - Mocker for Organisation objects
  • workspace - Mocker for Workspace objects
  • source - Mocker for Source objects
  • event - Mocker for Event objects

__init__

def __init__(workspace: Optional[Union[WorkspaceV1, WorkspaceSpec]] = None,
             organisation: Optional[Union[OrganisationV1,
                                          OrganisationSpec]] = None,
             data_source: Optional[Union[SourceSpec, SourceV1]] = None,
             data_sources: Optional[List[Union[SourceSpec, SourceV1]]] = None)

Initializes the MockV1 class.

Arguments:

  • workspace - The workspace to associate with the mock objects.
  • organisation - The organisation to associate with the mock objects.