def test_register(self): params = make_secret(password="******") sec = secret.Secret(params) con = vmfakecon.Connection() sec.register(con) virsec = con.secrets[sec.uuid] self.assertEqual(virsec.value, "12345678")
def test_encoded_password(self): params = make_secret(password="******") s = secret.Secret(params) self.assertEqual(s.password.value, "12345678")
def check(self, params, xml): s = secret.Secret(params) self.assertXMLEqual(s.toxml(), xml)
def test_supported_usage_types(self, usage_type): params = make_secret(usage_type=usage_type) s = secret.Secret(params) self.assertEqual(s.usage_type, usage_type)
def test_encoded_password(self): params = make_secret(password="******") s = secret.Secret(params) assert s.password.value == b"12345678"
def test_unencoded_password(self): params = make_secret() params["password"] = ProtectedPassword("not base64 value") with pytest.raises(ValueError): secret.Secret(params)
def test_unsupported_usage_types(self): params = make_secret(usage_type="unsupported") with pytest.raises(ValueError): secret.Secret(params)
def test_supported_usage_types(self, usage_type): params = make_secret(usage_type=usage_type) s = secret.Secret(params) assert s.usage_type == usage_type
def test_missing_required_params(self, name): params = make_secret() del params[name] with pytest.raises(ValueError): secret.Secret(params)