Esempio n. 1
0
def get_unchanged_skill_manifest(context):
    device_skill_repo = DeviceSkillRepository(context.db)
    skill_manifest = device_skill_repo.get_skill_manifest_for_device(
        context.device_id)
    assert_that(len(skill_manifest), equal_to(1))
    manifest_skill = skill_manifest[0]
    assert_that(manifest_skill, equal_to(context.manifest_skill))
Esempio n. 2
0
def get_skill_manifest_no_device_specific(context):
    device_skill_repo = DeviceSkillRepository(context.db)
    skill_manifest = device_skill_repo.get_skill_manifest_for_device(
        context.device_id)
    assert_that(len(skill_manifest), equal_to(1))
    remaining_skill = skill_manifest[0]
    assert_that(remaining_skill.skill_gid,
                not_(equal_to(context.device_specific_skill.skill_gid)))
Esempio n. 3
0
def get_unchanged_skill_manifest(context):
    """Check that the skill manifest on the database did not change."""
    device_skill_repo = DeviceSkillRepository(context.db)
    skill_manifest = device_skill_repo.get_skill_manifest_for_device(
        context.device_id)
    assert_that(len(skill_manifest), equal_to(1))
    manifest_skill = skill_manifest[0]
    assert_that(manifest_skill, equal_to(context.manifest_skill))
Esempio n. 4
0
def get_updated_skill_manifest(context):
    device_skill_repo = DeviceSkillRepository(context.db)
    skill_manifest = device_skill_repo.get_skill_manifest_for_device(
        context.device_id)
    assert_that(len(skill_manifest), equal_to(1))
    manifest_skill = skill_manifest[0]
    assert_that(manifest_skill, not_(equal_to(context.manifest_skill)))
    manifest_skill.update_ts = context.update_ts
    assert_that(manifest_skill, (equal_to(context.manifest_skill)))
Esempio n. 5
0
def get_skill_manifest_no_device_specific(context):
    """Check that there are no device-specific skills on the skill manifest."""
    device_skill_repo = DeviceSkillRepository(context.db)
    skill_manifest = device_skill_repo.get_skill_manifest_for_device(
        context.device_id)
    assert_that(len(skill_manifest), equal_to(1))
    remaining_skill = skill_manifest[0]
    assert_that(
        remaining_skill.skill_gid,
        not_(equal_to(context.device_specific_skill.skill_gid)),
    )
Esempio n. 6
0
def get_skill_manifest_new_skill(context):
    device_skill_repo = DeviceSkillRepository(context.db)
    skill_manifest = device_skill_repo.get_skill_manifest_for_device(
        context.device_id)
    assert_that(len(skill_manifest), equal_to(2))
    assert_that(context.manifest_skill, is_in(skill_manifest))

    # the device_skill id is not part of the request data so clear it out
    for manifest_skill in skill_manifest:
        if manifest_skill.skill_gid == context.new_skill.skill_gid:
            manifest_skill.id = None
            manifest_skill.skill_id = None
    assert_that(context.new_manifest_skill, is_in(skill_manifest))
Esempio n. 7
0
def get_empty_skill_manifest(context):
    device_skill_repo = DeviceSkillRepository(context.db)
    skill_manifest = device_skill_repo.get_skill_manifest_for_device(
        context.device_id)
    assert_that(len(skill_manifest), equal_to(0))
Esempio n. 8
0
def get_empty_skill_manifest(context):
    """Check for an empty skill manifest on the database."""
    device_skill_repo = DeviceSkillRepository(context.db)
    skill_manifest = device_skill_repo.get_skill_manifest_for_device(
        context.device_id)
    assert_that(len(skill_manifest), equal_to(0))