def test_integration_manifest():
    hacs_manifest = HacsManifest.from_dict({})
    manifest = {"name": "TEST-MANIFEST"}
    repository_name = "TEST-REPOSITORY-NAME"

    name = get_repository_name(hacs_manifest, repository_name, "integration", manifest)
    assert name == "TEST-MANIFEST"
Example #2
0
def test_repository_name():
    repository = dummy_repository_base()
    repository.data.full_name = "test/TEST-REPOSITORY-NAME"
    repository.repository_manifest = HacsManifest.from_dict({})

    name = get_repository_name(repository)
    assert name == "Test Repository Name"
def test_everything():
    hacs_manifest = HacsManifest.from_dict({"name": "TEST-HACS_MANIFEST"})
    manifest = {"name": "TEST-MANIFEST"}
    repository_name = "TEST-REPOSITORY-NAME"

    for category in ELEMENT_TYPES:
        name = get_repository_name(hacs_manifest, repository_name, category, manifest)
        assert name == "TEST-HACS_MANIFEST"
Example #4
0
def test_integration_manifest():
    repository = dummy_repository_base()
    repository.data.category = "integration"
    repository.data.full_name = "test/TEST-REPOSITORY-NAME"
    repository.repository_manifest = HacsManifest.from_dict({})
    repository.integration_manifest = {"name": "TEST-MANIFEST"}

    name = get_repository_name(repository)
    assert name == "TEST-MANIFEST"
Example #5
0
def test_everything():
    repository = dummy_repository_base()
    repository.data.full_name = "test/TEST-REPOSITORY-NAME"
    repository.repository_manifest = HacsManifest.from_dict(
        {"name": "TEST-HACS_MANIFEST"})
    repository.integration_manifest = {"name": "TEST-MANIFEST"}

    for category in ELEMENT_TYPES:
        repository.data.category = category
        name = get_repository_name(repository)
        assert name == "TEST-HACS_MANIFEST"
Example #6
0
def test_manifest_structure():
    manifest = HacsManifest.from_dict({"name": "TEST"})

    assert isinstance(manifest.manifest, dict)

    assert isinstance(manifest.name, str)
    assert manifest.name == "TEST"

    assert isinstance(manifest.content_in_root, bool)
    assert not manifest.content_in_root

    assert isinstance(manifest.zip_release, bool)
    assert not manifest.zip_release

    assert isinstance(manifest.filename, (str, type(None)))
    assert manifest.filename is None

    assert isinstance(manifest.domains, list)
    assert not manifest.domains

    assert isinstance(manifest.country, list)
    assert not manifest.country

    assert isinstance(manifest.homeassistant, (str, type(None)))
    assert manifest.homeassistant is None

    assert isinstance(manifest.persistent_directory, (str, type(None)))
    assert manifest.persistent_directory is None

    assert isinstance(manifest.iot_class, (str, type(None)))
    assert manifest.iot_class is None

    assert isinstance(manifest.render_readme, bool)
    assert not manifest.render_readme

    assert isinstance(manifest.hacs, (str, type(None)))
    assert not manifest.hacs

    assert isinstance(manifest.hide_default_branch, bool)
    assert not manifest.hide_default_branch
def test_repository_name():
    hacs_manifest = HacsManifest.from_dict({})
    repository_name = "TEST-REPOSITORY-NAME"

    name = get_repository_name(hacs_manifest, repository_name)
    assert name == "Test Repository Name"
Example #8
0
def test_edge_pass_none():
    with pytest.raises(HacsException):
        assert HacsManifest.from_dict(None)
Example #9
0
def test_edge_pass_none():
    with pytest.raises(HacsRepositoryInfo):
        assert HacsManifest.from_dict(None)