MCPcopy
hub / github.com/hacs/integration / test_add_remove_repository

Function test_add_remove_repository

tests/hacsbase/test_hacs.py:36–59  ·  view source on GitHub ↗
(hacs, repository, tmpdir)

Source from the content-addressed store, hash-verified

34
35
36async def test_add_remove_repository(hacs, repository, tmpdir):
37 hacs.hass.config.config_dir = tmpdir
38
39 repository.data.id = "0"
40 hacs.repositories.register(repository)
41
42 hacs.repositories.set_repository_id(repository, "42")
43
44 # Once its set, it should never change
45 with pytest.raises(ValueError):
46 hacs.repositories.set_repository_id(repository, "30")
47
48 # Safe to set it again
49 hacs.repositories.set_repository_id(repository, "42")
50
51 assert hacs.repositories.get_by_full_name("test/test") is repository
52 assert hacs.repositories.get_by_id("42") is repository
53
54 hacs.repositories.unregister(repository)
55 assert hacs.repositories.get_by_full_name("test/test") is None
56 assert hacs.repositories.get_by_id("42") is None
57
58 # Verify second removal does not raise
59 hacs.repositories.unregister(repository)

Callers

nothing calls this directly

Calls 5

registerMethod · 0.80
set_repository_idMethod · 0.80
get_by_full_nameMethod · 0.80
get_by_idMethod · 0.80
unregisterMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…