def test_write_config(self, options: Options, config_backup): options.timeout = 1337 options.license = License.COMMERCIAL options.password = "******" options.write() new_opt = Options.from_config() for k, v in options.__dict__.items(): if k == "cache": assert type(new_opt.cache) == type(options.cache) # noqa: E721 elif k == "password": # don't store the password in the file assert getattr(new_opt, k) is None elif k not in ("timeout", "license"): assert getattr(new_opt, k) == v assert new_opt.timeout == 1337 assert new_opt.license == License.COMMERCIAL
def test_valid_license(self, options: Options, license: License): options.license = license.value assert isinstance(options.license, License) assert options.license == license
def test_invalid_license(self, options: Options): with pytest.raises(ValueError): options.license = "foo"