Пример #1
0
 def test_run_component_create(self):
     run = Run(value=self.json_entries_runs[0])
     component = Component(value=self.json_entries_components[0])
     test_run_component = RunComponent(
         run_reference=run.to_reference(),
         component_reference=component.to_reference())
     test_run_component.save()
     assert "_id" in test_run_component.json
Пример #2
0
 def test_sample_component_create(self):
     sample = Sample(value=self.json_entries_samples[0])
     component = Component(value=self.json_entries_components[0])
     test_sample_component = SampleComponent(
         sample_reference=sample.to_reference(),
         component_reference=component.to_reference())
     test_sample_component.save()
     assert "_id" in test_sample_component.json
Пример #3
0
 def test_component_create_from_ref(self):
     _id = "000000000000000000000001"
     name = "test_component"
     component = Component.load(
         reference=ComponentReference(_id=_id, name=name))
     assert component.delete() == True
     test_component = Component(value=self.json_entries[0])
     test_component.save()
     json = component.json
     json.pop("version", None)
     json.pop("metadata", None)
     assert json == self.json_entries[0]
Пример #4
0
def initialize():
    with open(os.path.join(os.path.dirname(__file__), 'config.yaml')) as fh:
        config: Dict = yaml.load(fh, Loader=yaml.FullLoader)

    if not(datahandling.has_a_database_connection()):
        raise ConnectionError("BIFROST_DB_KEY is not set or other connection error")

    global COMPONENT
    try:
        component_ref = ComponentReference(name=config["name"])
        COMPONENT = Component.load(component_ref)
        if COMPONENT is not None and '_id' in COMPONENT.json:
                return
        else:
            COMPONENT = Component(value=config)
            install_component()

    except Exception as e:
        print(traceback.format_exc(), file=sys.stderr)
    return
Пример #5
0
 def test_component_create(self):
     test_component = Component(name="test_component")
     print(test_component)
     test_component.save()
     assert "_id" in test_component.json