本文整理汇总了Python中mommygae.mommy.save_one函数的典型用法代码示例。如果您正苦于以下问题:Python save_one函数的具体用法?Python save_one怎么用?Python save_one使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save_one函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_success_with_nodes
def test_success_with_nodes(self):
origin = mommy.save_one(Node)
destination = mommy.save_one(Node)
CreateUniqueArcExample(origin, destination)()
has_arc_cmd = HasArcExample(origin, destination)
self.assertIsNotNone(has_arc_cmd())
示例2: test_create_single_arc_for_second_time_error
def test_create_single_arc_for_second_time_error(self):
destination = mommy.save_one(Node)
origin = mommy.save_one(Node)
cmd = CreateSingleArcExample(origin, destination)
self.assert_arc_creation(cmd, origin, destination)
cmd = CreateSingleArcExample(origin, destination)
self.assertRaises(CommandExecutionException, cmd)
示例3: test_success
def test_success(self):
mommy.save_one(Jogo)
mommy.save_one(Jogo)
json_response = rest.index()
context = json_response.context
self.assertEqual(2, len(context))
jogo_dct = context[0]
self.assertSetEqual(set(['id', 'creation', 'foto', 'tmp', 'map', 'qtd', 'tit', 'grp']), set(jogo_dct.iterkeys()))
self.assert_can_serialize_as_json(json_response)
示例4: test_success
def test_success(self):
mommy.save_one(User)
mommy.save_one(User)
json_response = rest.index()
context = json_response.context
self.assertEqual(2, len(context))
user_dct = context[0]
self.assertSetEqual(set(['id', 'creation', 'password']), set(user_dct.iterkeys()))
self.assert_can_serialize_as_json(json_response)
示例5: test_only_destination_has_arc
def test_only_destination_has_arc(self):
origin = mommy.save_one(Node)
destination = mommy.save_one(Node)
another_origin = mommy.save_one(Node)
arc = CreateArcExample(origin, destination)()
self.assertEqual(arc.key, HasArcExample(origin=origin)())
self.assertEqual(arc.key, HasArcExample(destination=destination)())
self.assertEqual(arc.key, HasArcExample(origin, destination)())
self.assertIsNone(HasArcExample(another_origin, destination)())
示例6: test_success
def test_success(self):
mommy.save_one(Venda)
mommy.save_one(Venda)
json_response = rest.index()
context = json_response.context
self.assertEqual(2, len(context))
venda_dct = context[0]
self.assertSetEqual(set(['id', 'creation', 'preco','status']), set(venda_dct.iterkeys()))
self.assert_can_serialize_as_json(json_response)
示例7: test_success
def test_success(self):
mommy.save_one(Profile)
mommy.save_one(Profile)
json_response = rest.index()
context = json_response.context
self.assertEqual(2, len(context))
profile_dct = context[0]
self.assertSetEqual(set(['id', 'creation', 'user', 'tipo']), set(profile_dct.iterkeys()))
self.assert_can_serialize_as_json(json_response)
示例8: test_success
def test_success(self):
mommy.save_one(Formacao)
mommy.save_one(Formacao)
json_response = rest.index()
context = json_response.context
self.assertEqual(2, len(context))
formacao_dct = context[0]
self.assertSetEqual(set(['id', 'creation', 'titulo', 'data', 'conteudo']), set(formacao_dct.iterkeys()))
self.assert_can_serialize_as_json(json_response)
示例9: test_success
def test_success(self):
mommy.save_one(Evento)
mommy.save_one(Evento)
json_response = rest.index()
context = json_response.context
self.assertEqual(2, len(context))
evento_dct = context[0]
self.assertSetEqual(set(['id', 'creation', 'start', 'end', 'description', 'title']), set(evento_dct.iterkeys()))
self.assert_can_serialize_as_json(json_response)
示例10: test_success
def test_success(self):
mommy.save_one(Categoria)
mommy.save_one(Categoria)
json_response = rest.index()
context = json_response.context
self.assertEqual(2, len(context))
categoria_dct = context[0]
self.assertSetEqual(set(['id', 'creation', 'codigo', 'nome']), set(categoria_dct.iterkeys()))
self.assert_can_serialize_as_json(json_response)
示例11: test_success
def test_success(self):
mommy.save_one(Noticia)
mommy.save_one(Noticia)
json_response = rest.index()
context = json_response.context
self.assertEqual(2, len(context))
noticia_dct = context[0]
self.assertSetEqual(set(['id', 'creation', 'content', 'link', 'title']), set(noticia_dct.iterkeys()))
self.assert_can_serialize_as_json(json_response)
示例12: test_success
def test_success(self):
mommy.save_one(Membro)
mommy.save_one(Membro)
json_response = rest.index()
context = json_response.context
self.assertEqual(2, len(context))
membro_dct = context[0]
self.assertSetEqual(set(['id', 'creation', 'cargo', 'nome', 'cpf', 'rg', 'telefone', 'endereco', 'data']), set(membro_dct.iterkeys()))
self.assert_can_serialize_as_json(json_response)
示例13: setup_call_stat
def setup_call_stat(self, LoginClassMock):
login_obj = Login(None, None, None, None)
main_user = mommy.save_one(MainUser, email='[email protected]')
login_obj.result = main_user
login_obj.set_up = Mock()
login_obj.do_business = Mock()
login_obj.commit = lambda: None
LoginClassMock.return_value = login_obj
external_user = mommy.save_one(GoogleUser)
pending_key = PendingExternalToMainUser(external_user=external_user.key, main_user=main_user.key).put()
return external_user, main_user, pending_key
示例14: test_delete
def test_delete(self):
model = mommy.save_one(ModelStub)
self.assertIsNotNone(model.key.get())
DeleteCommand(model.key).execute()
self.assertIsNone(model.key.get())
models = [mommy.save_one(ModelStub) for i in range(3)]
model_keys = [m.key for m in models]
self.assertListEqual(models, ndb.get_multi(model_keys))
DeleteCommand(*model_keys).execute()
self.assertListEqual([None, None, None], ndb.get_multi(model_keys))
示例15: test_create_arc_with_commands
def test_create_arc_with_commands(self):
destination = mommy.save_one(Node)
origin = mommy.save_one(Node)
cmd = CreateArcExample(NodeSearch(origin), destination)
self.assert_arc_creation(cmd, origin, destination)
cmd = CreateArcExample(origin, NodeSearch(destination))
self.assert_arc_creation(cmd, origin, destination)
cmd = CreateArcExample(NodeSearch(origin), NodeSearch(destination))
self.assert_arc_creation(cmd, origin, destination)