示例#1
0
    def test_qcl_exists(self):
        qcl = test_util.add_qcl(self.session)
        assert self.series_service.qcl_exists(qcl) == True

        qcl.code = "00000"
        qcl.definition = "A new definition"
        assert self.series_service.qcl_exists(qcl) == False
示例#2
0
    def test_save_series(self):
        series = Series()
        site = test_util.add_site(self.session)
        variable = test_util.add_variable(self.session)
        method = test_util.add_method(self.session)
        source = test_util.add_source(self.session)
        qcl = test_util.add_qcl(self.session)

        series.site_id = site.id
        series.variable_id = variable.id
        series.method_id = method.id
        series.source_id = source.id
        series.quality_control_level_id = qcl.id

        dvs = []
        for val in range(10):
            dv = DataValue()
            dv.data_value = val
            dv.site_id = site.id
            dv.variable_id = variable.id
            dv.method_id = method.id
            dv.source_id = source.id
            dv.quality_control_level_id = qcl.id
            dvs.append(dv)

        print series.variable_code
        assert self.series_service.save_series(series, dvs) == True
        assert self.series_service.series_exists(site.id, variable.id,
                                                 method.id, source.id,
                                                 qcl.id) == True
        assert self.series_service.save_series(series, dvs) == False
示例#3
0
    def test_create_new_series(self):
        site = test_util.add_site(self.session)
        variable = test_util.add_variable(self.session)
        method = test_util.add_method(self.session)
        source = test_util.add_source(self.session)
        qcl = test_util.add_qcl(self.session)

        dvs = []
        for val in range(10):
            dv = DataValue()
            dv.data_value = val
            dv.site_id = site.id
            dv.variable_id = variable.id
            dv.method_id = method.id
            dv.source_id = source.id
            dv.quality_control_level_id = qcl.id
            dvs.append(dv)

        series = self.series_service.create_new_series(dvs, site.id,
                                                       variable.id, method.id,
                                                       source.id, qcl.id)
        assert series != None
        assert len(series.data_values) == 10
        assert series.site_id == site.id
        assert series.variable_id == variable.id
示例#4
0
	def test_qcl_exists(self):
		qcl = test_util.add_qcl(self.session)
		assert self.series_service.qcl_exists(qcl) == True

		qcl.code = "00000"
		qcl.definition = "A new definition"
		assert self.series_service.qcl_exists(qcl) == False
示例#5
0
	def test_save_series(self):
		series = Series()
		site = test_util.add_site(self.session)
		variable = test_util.add_variable(self.session)
		method = test_util.add_method(self.session)
		source = test_util.add_source(self.session)
		qcl = test_util.add_qcl(self.session)

		series.site_id = site.id
		series.variable_id = variable.id
		series.method_id = method.id
		series.source_id = source.id
		series.quality_control_level_id = qcl.id

		dvs = []
		for val in range(10):
			dv = DataValue()
			dv.data_value = val
			dv.site_id = site.id
			dv.variable_id = variable.id
			dv.method_id = method.id
			dv.source_id = source.id
			dv.quality_control_level_id = qcl.id
			dvs.append(dv)

		print series.variable_code
		assert self.series_service.save_series(series, dvs) == True
		assert self.series_service.series_exists(site.id, variable.id, method.id, source.id, qcl.id) == True
		assert self.series_service.save_series(series, dvs) == False
示例#6
0
    def test_get_all_qcls(self):
        assert self.series_service.get_all_qcls() == []

        qcl = test_util.add_qcl(self.session)
        all_qcls = self.series_service.get_all_qcls()

        assert len(all_qcls) == 1
        assert qcl.id == all_qcls[0].id
示例#7
0
	def test_get_all_qcls(self):
		assert self.series_service.get_all_qcls() == []

		qcl = test_util.add_qcl(self.session)
		all_qcls = self.series_service.get_all_qcls()

		assert len(all_qcls) == 1
		assert qcl.id == all_qcls[0].id
示例#8
0
	def test_create_new_series(self):
		site = test_util.add_site(self.session)
		variable = test_util.add_variable(self.session)
		method = test_util.add_method(self.session)
		source = test_util.add_source(self.session)
		qcl = test_util.add_qcl(self.session)

		dvs = []
		for val in range(10):
			dv = DataValue()
			dv.data_value = val
			dv.site_id = site.id
			dv.variable_id = variable.id
			dv.method_id = method.id
			dv.source_id = source.id
			dv.quality_control_level_id = qcl.id
			dvs.append(dv)

		series = self.series_service.create_new_series(dvs, site.id, variable.id, method.id, source.id, qcl.id)
		assert series != None
		assert len(series.data_values) == 10
		assert series.site_id == site.id
		assert series.variable_id == variable.id
示例#9
0
    def test_get_qcl_by_id(self):
        assert self.series_service.get_qcl_by_id(10) == None

        qcl = test_util.add_qcl(self.session)
        db_qcl = self.series_service.get_qcl_by_id(qcl.id)
        assert qcl.code == db_qcl.code
示例#10
0
	def test_get_qcl_by_id(self):
		assert self.series_service.get_qcl_by_id(10) == None

		qcl = test_util.add_qcl(self.session)
		db_qcl = self.series_service.get_qcl_by_id(qcl.id)
		assert qcl.code == db_qcl.code