Commit 853879a8 authored by Anton Palgunov's avatar Anton Palgunov

fix load shop

parent 5f43805a
......@@ -107,9 +107,17 @@ def retrieve_modules_full_list(force_refresh=False, initial_page=1, per_page=30)
# Пробуем скачать module.yaml
print(item)
raw_url = f"https://raw.githubusercontent.com/{item['owner']['login']}/{item['name']}/{item['default_branch']}/module.yaml"
module_info = parse_module_yaml(raw_url)
raw_url_yaml = f"https://raw.githubusercontent.com/{item['owner']['login']}/{item['name']}/{item['default_branch']}/module.yaml"
raw_url_yml = f"https://raw.githubusercontent.com/{item['owner']['login']}/{item['name']}/{item['default_branch']}/module.yml"
module_info = parse_module_yaml(raw_url_yaml)
if not module_info:
module_info = parse_module_yaml(raw_url_yml)
if not module_info:
print(f"Failed to parse module.yaml for {item['full_name']}")
continue
aggregated_repos.append({
"source": "github",
"repo_name": item["name"],
......
......@@ -9,6 +9,17 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')
from shop.main import retrieve_modules_full_list, load_from_cache, save_to_cache, fetch_repos_from_github, fetch_repos_from_gitlab
@patch("shop.main.load_from_cache")
@patch("shop.main.save_to_cache")
def test_retrive_real_data(mock_save_cache, mock_load_cache):
# Mock cache data
mock_load_cache.return_value = (None, 0)
repos = retrieve_modules_full_list(force_refresh=True, initial_page=1, per_page=30)
assert len(repos) > 0
@patch("shop.main.load_from_cache")
@patch("shop.main.save_to_cache")
@patch("shop.main.fetch_repos_from_github")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment