Exemple #1
0
def test_get_technologies(session):
    """Verify that the get_technologies returns all the technologies in the database."""
    techs = [
        Technologies(id=1231, description='123 Tech'),
        Technologies(id=5671, description='567 Tech'),
        Technologies(id=8901, description='890 Tech')
    ]
    session.bulk_save_objects(techs)
    session.commit()
    assert Technologies.get_technologies()
Exemple #2
0
def test_get_technologies_names(session):
    """Verify that the get_technologies_names() return names of all technologies."""
    techs = [
        Technologies(id=12312, description='123 Tech'),
        Technologies(id=56712, description='567 Tech'),
        Technologies(id=89012, description='890 Tech')
    ]
    session.bulk_save_objects(techs)
    session.commit()
    for name in Technologies.get_technologies_names():
        assert isinstance(name, str)
Exemple #3
0
def test_get_technology_by_id(session):
    """Verify that the get_technology_by_id() returns description provided the id is given."""
    techs = [
        Technologies(id=123123, description='123 Tech'),
        Technologies(id=567123, description='567 Tech'),
        Technologies(id=890123, description='890 Tech')
    ]
    session.bulk_save_objects(techs)
    session.commit()
    assert Technologies.get_technology_by_id(123123) == '123 Tech'
    assert Technologies.get_technology_by_id(567123) == '567 Tech'
    assert Technologies.get_technology_by_id(890123) == '890 Tech'
    assert Technologies.get_technology_by_id(283802818388) is None
Exemple #4
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