Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions archinstall/lib/profile/profiles_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ def _import_profile_from_url(self, url: str) -> None:

profiles = self._process_profile_file(filepath)
self.remove_custom_profiles(profiles)
self.add_custom_profiles(profiles)

def _load_profile_class(self, module: ModuleType) -> list[Profile]:
"""
Expand Down
29 changes: 29 additions & 0 deletions tests/test_profile_url_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from pytest import MonkeyPatch

from archinstall.lib.profile.profiles_handler import ProfileHandler, ProfileSerialization


def test_parse_profile_config_imports_profile_from_url(monkeypatch: MonkeyPatch) -> None:
custom_profile_code = b"""
from archinstall.default_profiles.profile import Profile, ProfileType

class CustomUrlProfile(Profile):
def __init__(self) -> None:
super().__init__('CustomUrlProfile', ProfileType.CustomType)
"""

monkeypatch.setattr(
'archinstall.lib.profile.profiles_handler.fetch_data_from_url',
lambda _url: custom_profile_code,
)

handler = ProfileHandler()
profile_config: ProfileSerialization = {
'path': 'https://example.com/custom_profile.py',
'main': 'CustomUrlProfile',
}

profile = handler.parse_profile_config(profile_config)

assert profile is not None
assert profile.name == 'CustomUrlProfile'