cards.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:mongoaudit 作者: stampery 项目源码 文件源码
def uri_prompt(self, title, label, uri_example, tests):
        """
        Args:
          title (str): Title for the test page
          label (str): label for the input field
          uri_example (str): example of a valid URI
          tests (Test[]): test to pass as argument to run_test
        """
        intro = urwid.Pile([
            urwid.Text(('text bold', title + ' test suite')),
            DIV,
            urwid.Text([label + ' (', ('text italic', uri_example), ')'])
        ])

        def _next(form, uri):
            form.set_message("validating URI")
            cred = validate_uri(uri)
            if cred:
                form.set_message("Checking MongoDB connection...")
                tester = Tester(cred, tests)
                if tester.info:
                    self.run_test(cred, title, tester, tests)
                else:
                    form.set_message("Couldn't find a MongoDB server", True)
            else:
                form.set_message("Invalid domain", True)


        form = FormCard(
            {"content": intro, "app": self.app}, ['URI'],
            'Run ' + title.lower() + ' test suite',
            {'next': _next, 'back': self.choose_test})
        self.app.render(form)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号