Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_find_file_release():
repository = dummy_repository_plugin()
repository.releases.objects = [
AIOGitHubAPIRepositoryRelease(
{"tag_name": "3", "assets": [{"name": "test.js"}]}
)
]
find_file_name(repository)
assert repository.data.file_name == "test.js"
assert repository.content.path.remote == "release"
def test_gather_zip_release():
repository = dummy_repository_plugin()
repository.data.file_name = "test.zip"
repository.data.zip_release = True
repository.data.filename = "test.zip"
repository.releases.objects = [
AIOGitHubAPIRepositoryRelease(
{"tag_name": "3", "assets": [{"name": "test.zip"}]}
)
]
files = [x.name for x in gather_files_to_download(repository)]
assert "test.zip" in files
def test_gather_plugin_files_from_release():
repository = dummy_repository_plugin()
repository.data.file_name = "test.js"
repository.data.releases = True
release = AIOGitHubAPIRepositoryRelease(
{"tag_name": "3", "assets": [{"name": "test.js"}]}
)
repository.releases.objects = [release]
files = [x.name for x in gather_files_to_download(repository)]
assert "test.js" in files
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 == ""
def test_gather_plugin_files_from_release_multiple():
repository = dummy_repository_plugin()
repository.data.file_name = "test.js"
repository.data.releases = True
repository.releases.objects = [
AIOGitHubAPIRepositoryRelease(
{"tag_name": "3", "assets": [{"name": "test.js"}, {"name": "test.png"}]}
)
]
files = [x.name for x in gather_files_to_download(repository)]
assert "test.js" in files
assert "test.png" in files