Ejemplo n.º 1
0
 def init_instance_segment_data(self):
     instance_segment = self.instance_segment.copy()
     instance_info = self.instance_info.copy()
     instance_info_ref = db_api.instance_info_create(instance_info)
     instance_segment["instance_info_id"] = instance_info_ref.id
     db_api.instance_segment_create(instance_segment)
     db_api.instance_segment_end(self.instance_id,
         datetime.datetime(2011, 1, 2, 0, 0))
Ejemplo n.º 2
0
    def test_instance_segment(self):
        """ Test instance_info_create and instance_segment_end"""
        instance_info = self.instance_info.copy()
        instance_segment = self.instance_segment.copy()
        instance_info_ref = db_api.instance_info_create(instance_info)
        instance_segment["instance_info_id"] = instance_info_ref.id
        instance_segment_ref = db_api.instance_segment_create(instance_segment)

        self.assertTrue(hasattr(instance_segment_ref, "id"))

        db_api.instance_segment_end(self.instance_id,
            datetime.datetime(2011, 1, 2, 0, 0))
Ejemplo n.º 3
0
    def test_instance_info_get_latest(self):
        instance_segment = self.instance_segment.copy()
        instance_info = self.instance_info.copy()
        instance_info_ref = db_api.instance_info_create(instance_info)
        instance_segment["instance_info_id"] = instance_info_ref.id
        db_api.instance_segment_create(instance_segment)
        db_api.instance_segment_end(self.instance_id,
            datetime.datetime(2011, 1, 2, 0, 0))

        self.assertEqual(instance_info_ref.id,
            db_api.instance_info_get_latest(self.instance_id))

        instance_info_ref = db_api.instance_info_create(instance_info)
        instance_segment["instance_info_id"] = instance_info_ref.id
        self.assertEqual(instance_info_ref.id,
            db_api.instance_info_get_latest(self.instance_id))