portal = context.getPortalObject()
portal_catalog = portal.portal_catalog

REFERENCE_SEPARATOR = portal.getIngestionReferenceDictionary()["reference_separator"]
NONE = portal.getIngestionReferenceDictionary()["none_extension"]


# --------------- FAKE DATA SET ---------------------

reference = "test_dataset"
portal_type = "Data Set"

query_dict = { "portal_type": portal_type,
               "reference" : reference}

result = portal_catalog(**query_dict)
if len(result) is 0:
  data_set = portal.data_set_module.newContent(
    portal_type = portal_type,
    reference = reference,
    title = "Fake Data for test")
  data_set.validate()

reference = REFERENCE_SEPARATOR.join([reference, "fake_data", NONE])

# --------------- FAKE DATA STREAM ---------------------
portal_type = "Data Stream"

data_stream = portal.data_stream_module.newContent(
  portal_type = portal_type,
  reference = reference,
  title = "Fake Data for test")

data_stream.validate()

# --------------- FAKE DATA DESCRIPTOR ---------------------
portal_type = "Data Descriptor"

data_descriptor = portal.data_descriptor_module.newContent(
  portal_type = portal_type,
  reference = reference,
  title = "Fake Data for test")

return "Fake Data created."
