def test_gather_appdaemon_files_with_subdir():
    repository = dummy_repository_appdaemon()
    repository.data.file_name = "test.py"
    repository.tree = [
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "test.py", "type": "blob"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "apps/test/test.py", "type": "blob"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "apps/test/core/test.py", "type": "blob"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "apps/test/devices/test.py", "type": "blob"}, "test/test", "master"
        ),
        AIOGitHubAPIRepositoryTreeContent(
            {"path": "apps/test/test/test.py", "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.py" not in files
    assert "apps/test/test.py" in files
    assert "apps/test/devices/test.py" in files
    assert "apps/test/test/test.py" in files
    assert "apps/test/core/test.py" in files
Exemple #2
0
def test_gather_appdaemon_files_base():
    repository = dummy_repository_appdaemon()
    repository.tree = [
        AIOGithubTreeContent(
            {"path": "test.py", "type": "blob"}, "test/test", "master"
        ),
        AIOGithubTreeContent(
            {"path": "apps/test/test.py", "type": "blob"}, "test/test", "master"
        ),
        AIOGithubTreeContent(
            {"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.py" not in files
    assert "apps/test/test.py" in files