本文整理汇总了Python中nova.api.metadata.password.handle_password函数的典型用法代码示例。如果您正苦于以下问题:Python handle_password函数的具体用法?Python handle_password怎么用?Python handle_password使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了handle_password函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _try_set_password
def _try_set_password(self, val='bar'):
request = webob.Request.blank('')
request.method = 'POST'
request.body = val
self.stubs.Set(db, 'instance_system_metadata_update',
lambda *a, **kw: None)
password.handle_password(request, self.mdinst)
示例2: _try_set_password
def _try_set_password(self, get_by_uuid, val='bar'):
request = webob.Request.blank('')
request.method = 'POST'
request.body = val
get_by_uuid.return_value = self.instance
with mock.patch.object(self.instance, 'save') as save:
password.handle_password(request, self.mdinst)
save.assert_called_once_with()
self.assertIn('password_0', self.instance.system_metadata)
示例3: _try_set_password
def _try_set_password(self, get_by_uuid, val="bar"):
request = webob.Request.blank("")
request.method = "POST"
request.body = val
get_by_uuid.return_value = self.instance
with mock.patch.object(self.instance, "save") as save:
password.handle_password(request, self.mdinst)
save.assert_called_once_with()
self.assertIn("password_0", self.instance.system_metadata)
示例4: _try_set_password
def _try_set_password(self, val="bar"):
request = webob.Request.blank("")
request.method = "POST"
request.body = val
self.stubs.Set(db, "instance_get_by_uuid", lambda *a, **kw: {"system_metadata": []})
def fake_instance_update(context, uuid, updates):
self.assertIn("system_metadata", updates)
self.assertIn("password_0", updates["system_metadata"])
return self.instance, self.instance
self.stubs.Set(db, "instance_update_and_get_original", fake_instance_update)
password.handle_password(request, self.mdinst)
示例5: _try_set_password
def _try_set_password(self, val='bar'):
request = webob.Request.blank('')
request.method = 'POST'
request.body = val
self.stubs.Set(db, 'instance_get_by_uuid',
lambda *a, **kw: {'system_metadata': []})
def fake_instance_update(context, uuid, updates):
self.assertIn('system_metadata', updates)
self.assertIn('password_0', updates['system_metadata'])
return self.instance, self.instance
self.stubs.Set(db, 'instance_update_and_get_original',
fake_instance_update)
password.handle_password(request, self.mdinst)
示例6: test_get_password
def test_get_password(self):
request = webob.Request.blank('')
self.mdinst.password = 'foo'
result = password.handle_password(request, self.mdinst)
self.assertEqual(result, 'foo')
示例7: test_get_password
def test_get_password(self):
request = webob.Request.blank("")
self.mdinst.password = "foo"
result = password.handle_password(request, self.mdinst)
self.assertEqual(result, "foo")
示例8: _try_set_password
def _try_set_password(self, val="bar"):
request = webob.Request.blank("")
request.method = "POST"
request.body = val
self.stubs.Set(db, "instance_system_metadata_update", lambda *a, **kw: None)
password.handle_password(request, self.mdinst)