本文整理汇总了Python中app.App.addAutor方法的典型用法代码示例。如果您正苦于以下问题:Python App.addAutor方法的具体用法?Python App.addAutor怎么用?Python App.addAutor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.App
的用法示例。
在下文中一共展示了App.addAutor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestCase
# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import addAutor [as 别名]
class TestCase(unittest.TestCase):
"""
an test case to test this application
"""
## constants variables - probably on other class of Publica
id_site = 1 # test site
schema = None # to set on setUp
request = None
title = "Noticia - unittest"
app = None
lasttest = False
def setUp(self):
"""
Provide the test enviroment with these actions:
install an instance of this application and
install a portlet with default code of this application and
install a page with previous portlet and
install and configure a folder with this application
"""
if not self.schema:
self.request = FakeRequest()
self.request.request["env.mk"] = settings.MAGIC_KEY
self.schema = "noticia_unittest"
self.portal = PortalUtils(self.id_site, self.request)
self.portal.installApp(schema=self.schema,
meta_type=meta_type,
title=self.title)
self.app = App(id_site=self.id_site,
schema=self.schema,
request=self.request)
## add aplicativo
## add portlet, pagina
## add folder e configurar aplicativo
def tearDown(self):
"""
Delete current test enviroment with these actions:
delete the folder, page, portlet, content of the application(portal)
delete application
"""
## deletar itens usados
## deletar pagina, portlet
## deletar conteudo aplicativo - portal
## deletar aplicativo
if self.lasttest:
self.portal.unistallApp(schema=self.schema)
self.schema = None
def test_1_tipos(self):
"""
Test if the table tipo_noticia was populate
"""
qtde = len([i for i in self.app._getTipo()])
self.assertTrue(qtde > 0)
def test_2_addautor(self):
"""
Test method to add new autors
"""
for nome, email, grupo in (("Autor 1", "[email protected]", "grupo 1"),
("Autor 2", "[email protected]", "")):
self.app.addAutor(nome=nome,
email=email,
grupo=grupo)
def test_3_listautor(self):
"""
Test methods of listing autors
"""
[i for i in self.app._listarAutores()]
self.app.getAutores()
def test_4_getautor(self):
"""
Test method to get content of autor
"""
self.app.getAutor(1)
def test_5_editautor(self):
"""
Test edit method of autor
"""
for i in self.app._listarAutores():
self.app.editAutor(id_autor=i["id_autor"],
nome="%s-edited" % i["nome"],
email="%s-edited" % i["email"],
grupo="%s-edited" % i["grupo"])
def test_6_delautor(self):
#.........这里部分代码省略.........