Пример #1
0
def test_get_technology_id(session):
    """Verify that the get_technology_id() returns
    correct id of the technology in the table provided
    technology type.
    """
    # insert data
    techs = [
        Technologies(id=123, description='123 Tech'),
        Technologies(id=567, description='567 Tech'),
        Technologies(id=890, description='890 Tech')
    ]
    session.bulk_save_objects(techs)
    session.commit()
    assert Technologies.get_technology_id('123 Tech') == 123
    assert Technologies.get_technology_id('567 Tech') == 567
    assert Technologies.get_technology_id('890 Tech') == 890
    assert Technologies.get_technology_id('hdheukkslkl') is None
 def __init__(self, reg_device_id, technology):
     """Constructor."""
     self.reg_device_id = reg_device_id
     self.technology_id = Technologies.get_technology_id(technology)