(hacs, repository, tmpdir)
| 34 | |
| 35 | |
| 36 | async 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) |
nothing calls this directly
no test coverage detected
searching dependent graphs…