How to use the aiogithubapi.objects.repository.content.AIOGitHubAPIRepositoryTreeContent function in aiogithubapi

To help you get started, we’ve selected a few aiogithubapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hacs / integration / tests / helpers / download / test_gather_files_to_download.py View on Github external
def test_gather_netdaemon_files_base():
    repository = dummy_repository_netdaemon()
    repository.tree = [
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "test.cs", "type": "blob"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "apps/test/test.cs", "type": "blob"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "apps/test/test.yaml", "type": "blob"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": ".github/file.file", "type": "blob"}, "test/test", "master"
        ),
    ]
    files = [x.path for x in gather_files_to_download(repository)]
    assert ".github/file.file" not in files
    assert "test.cs" not in files
    assert "apps/test/test.cs" in files
github hacs / integration / tests / helpers / filters / test_find_first_of_filetype.py View on Github external
def test_not_valid():
    tree = [
        AIOGitHubAPIRepositoryTreeContent(
            {"path": ".github/path/file.yaml", "type": "blob"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": ".github/path/file.js", "type": "blob"}, "test/test", "master"
        ),
    ]
    assert not find_first_of_filetype(tree, "file", "filename")
github hacs / integration / tests / helpers / filters / test_get_first_directory_in_directory.py View on Github external
def test_not_valid():
    tree = [
        AIOGitHubAPIRepositoryTreeContent(
            {"path": ".github/path/file.file", "type": "tree"}, "test/test", "master"
        )
    ]
    assert get_first_directory_in_directory(tree, "test") is None
github hacs / integration / tests / helpers / information / test_get_integration_manifest.py View on Github external
aresponses.add(
        "api.github.com",
        "/repos/test/test/contents/custom_components/test/manifest.json",
        "get",
        aresponses.Response(
            body=json.dumps({"content": content.decode("utf-8")}),
            headers=response_rate_limit_header,
        ),
    )

    async with aiohttp.ClientSession(loop=event_loop) as session:
        repository = dummy_repository_integration()
        repository.repository_object = await get_repository(session, TOKEN, "test/test")
        repository.content.path.remote = "custom_components/test"
        repository.tree = [
            AIOGitHubAPIRepositoryTreeContent(
                {"path": "custom_components/test/manifest.json", "type": "blob"},
                "test/test",
                "master",
            )
        ]
        await get_integration_manifest(repository)
        assert repository.data.domain == integration_manifest["domain"]
github hacs / integration / tests / helpers / download / test_download_content.py View on Github external
)
    hacs = get_hacs()
    hacs.system.config_path = tmp_path
    repository = dummy_repository_integration()
    repository.data.domain = "test"
    repository.content.path.local = repository.localpath
    repository.content.path.remote = "custom_components/test"
    integration_files = [
        "__init__.py",
        "sensor.py",
        "translations/en.json",
        "manifest.json",
    ]
    for integration_file in integration_files:
        repository.tree.append(
            AIOGitHubAPIRepositoryTreeContent(
                {"path": f"custom_components/test/{integration_file}", "type": "blob"},
                "test/test",
                "master",
            )
        )

    async with aiohttp.ClientSession(loop=event_loop) as session:
        hacs.hass.loop = event_loop
        hacs.session = session
        await download_content(repository)
        for path in repository.tree:
            assert os.path.exists(f"{hacs.system.config_path}/{path.full_path}")
github hacs / integration / tests / helpers / information / test_find_file_name.py View on Github external
def test_find_file_release_no_asset():
    repository = dummy_repository_plugin()
    repository.releases.objects = [
        AIOGitHubAPIRepositoryRelease({"tag_name": "3", "assets": []})
    ]
    repository.tree = [
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "test.js", "type": "blob"}, "test/test", "master"
        )
    ]
    find_file_name(repository)
    assert repository.data.file_name == "test.js"
    assert repository.content.path.remote == ""
github hacs / integration / tests / helpers / download / test_gather_files_to_download.py View on Github external
def test_gather_plugin_files_from_root():
    repository = dummy_repository_plugin()
    repository.content.path.remote = ""
    repository.tree = [
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "test.js", "type": "blob"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "dir", "type": "tree"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "aaaa.js", "type": "blob"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "dist/test.js", "type": "blob"}, "test/test", "master"
        ),
    ]
    find_file_name(repository)
    files = [x.path for x in gather_files_to_download(repository)]
    assert "test.js" in files
    assert "dir" not in files
    assert "aaaa.js" in files
    assert "dist/test.js" not in files
github hacs / integration / tests / helpers / download / test_gather_files_to_download.py View on Github external
def test_gather_plugin_multiple_plugin_files_from_dist():
    repository = dummy_repository_plugin()
    repository.content.path.remote = "dist"
    repository.data.file_name = "test.js"
    repository.tree = [
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "test.js", "type": "blob"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "dist/test.js", "type": "blob"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "dist/something_other.js", "type": "blob"}, "test/test", "master"
        ),
    ]
    files = [x.path for x in gather_files_to_download(repository)]
    assert "test.js" not in files
    assert "dist/test.js" in files
    assert "dist/something_other.js" in files
github hacs / integration / tests / helpers / download / test_gather_files_to_download.py View on Github external
def test_gather_plugin_different_card_name():
    repository = dummy_repository_plugin()
    repository.content.path.remote = ""
    repository.data.file_name = "card.js"
    repository.tree = [
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "card.js", "type": "blob"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "info.md", "type": "blob"}, "test/test", "master"
        ),
    ]
    find_file_name(repository)
    files = [x.path for x in gather_files_to_download(repository)]
    assert "card.js" in files
    assert "info.md" not in files
github hacs / integration / tests / helpers / information / test_find_file_name.py View on Github external
def test_find_file_name_base():
    repository = dummy_repository_plugin()
    repository.tree = [
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "test.js", "type": "blob"}, "test/test", "master"
        )
    ]
    find_file_name(repository)
    assert repository.data.file_name == "test.js"
    assert repository.content.path.remote == ""