当前位置: 首页>>代码示例>>Python>>正文


Python App._listarAutores方法代码示例

本文整理汇总了Python中app.App._listarAutores方法的典型用法代码示例。如果您正苦于以下问题:Python App._listarAutores方法的具体用法?Python App._listarAutores怎么用?Python App._listarAutores使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app.App的用法示例。


在下文中一共展示了App._listarAutores方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestCase

# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import _listarAutores [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):
#.........这里部分代码省略.........
开发者ID:bergjr,项目名称:OPovo-aplicativos,代码行数:103,代码来源:test.py


注:本文中的app.App._listarAutores方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。