def test_get_unit_by_name(self):
        assert self.series_service.get_unit_by_name("FAIL") == None

        unit = test_util.add_unit(self.session)
        db_unit = self.series_service.get_unit_by_name(unit.name)

        assert unit.id == db_unit.id
    def test_get_unit_by_id(self):
        assert self.series_service.get_unit_by_id(10) == None

        unit = test_util.add_unit(self.session)
        db_unit = self.series_service.get_unit_by_id(unit.id)

        assert unit.name == db_unit.name
    def test_get_unit_by_id(self):
        assert self.series_service.get_unit_by_id(10) == None

        unit = test_util.add_unit(self.session)
        db_unit = self.series_service.get_unit_by_id(unit.id)

        assert unit.name == db_unit.name
    def test_get_unit_by_name(self):
        assert self.series_service.get_unit_by_name("FAIL") == None

        unit = test_util.add_unit(self.session)
        db_unit = self.series_service.get_unit_by_name(unit.name)

        assert unit.id == db_unit.id
Example #5
0
    def test_get_units(self):
        assert self.cv_service.get_units() == []

        unit = test_util.add_unit(self.session)
        units = self.cv_service.get_units()
        assert len(units) == 1
        assert unit.id == units[0].id
    def test_get_all_units(self):
        assert self.series_service.get_all_units() == []

        unit = test_util.add_unit(self.session)
        units = self.series_service.get_all_units()

        assert len(units) == 1
        assert unit.name == units[0].name
    def test_get_all_units(self):
        assert self.series_service.get_all_units() == []

        unit = test_util.add_unit(self.session)
        units = self.series_service.get_all_units()

        assert len(units) == 1
        assert unit.name == units[0].name
Example #8
0
    def test_get_offset_type_cvs(self):
        assert self.cv_service.get_offset_type_cvs() == []

        unit = test_util.add_unit(self.session)
        offset = test_util.add_offset_type_cv(self.session, unit.id)

        db_offset = self.cv_service.get_offset_type_cvs()[0]
        assert offset.id == db_offset.id
        assert offset.unit_id == db_offset.unit_id
    def test_create_variable(self):
        unit = test_util.add_unit(self.session)
        variable = self.series_service.create_variable("Code", "Name", "Speciation", unit.id, "SampleMedium",
                                                       "ValueType", True,  # is_regular
                                                       5.0,  # time_support
                                                       unit.id,  # time_unit_id
                                                       "DataType", "GeneralCategory", -999.0)  # no_data_value

        assert variable.id != None
        assert variable.code == "Code"
        assert variable.variable_unit_id == unit.id
    def test_create_variable(self):
        unit = test_util.add_unit(self.session)
        variable = self.series_service.create_variable(
            "Code",
            "Name",
            "Speciation",
            unit.id,
            "SampleMedium",
            "ValueType",
            True,  # is_regular
            5.0,  # time_support
            unit.id,  # time_unit_id
            "DataType",
            "GeneralCategory",
            -999.0)  # no_data_value

        assert variable.id != None
        assert variable.code == "Code"
        assert variable.variable_unit_id == unit.id