Example #1
0
 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")
Example #2
0
 def test_encoded_password(self):
     params = make_secret(password="******")
     s = secret.Secret(params)
     self.assertEqual(s.password.value, "12345678")
Example #3
0
 def check(self, params, xml):
     s = secret.Secret(params)
     self.assertXMLEqual(s.toxml(), xml)
Example #4
0
 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)
Example #5
0
 def test_encoded_password(self):
     params = make_secret(password="******")
     s = secret.Secret(params)
     assert s.password.value == b"12345678"
Example #6
0
 def test_unencoded_password(self):
     params = make_secret()
     params["password"] = ProtectedPassword("not base64 value")
     with pytest.raises(ValueError):
         secret.Secret(params)
Example #7
0
 def test_unsupported_usage_types(self):
     params = make_secret(usage_type="unsupported")
     with pytest.raises(ValueError):
         secret.Secret(params)
Example #8
0
 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
Example #9
0
 def test_missing_required_params(self, name):
     params = make_secret()
     del params[name]
     with pytest.raises(ValueError):
         secret.Secret(params)