• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tests.clicomm函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.clicomm函数的典型用法代码示例。如果您正苦于以下问题:Python clicomm函数的具体用法?Python clicomm怎么用?Python clicomm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test03NewBugBasic

    def test03NewBugBasic(self):
        """
        Create a bug with minimal amount of fields, then close it
        """
        bz = self.bzclass(url=self.url)
        component = "python-bugzilla"
        version = "rawhide"
        summary = ("python-bugzilla test basic bug %s" %
                   datetime.datetime.today())
        newout = tests.clicomm("bugzilla new "
            "--product Fedora --component %s --version %s "
            "--summary \"%s\" "
            "--comment \"Test bug from the python-bugzilla test suite\" "
            "--outputformat \"%%{bug_id}\"" %
            (component, version, summary), bz)

        self.assertTrue(len(newout.splitlines()) == 3)

        bugid = int(newout.splitlines()[2])
        bug = bz.getbug(bugid)
        print("\nCreated bugid: %s" % bugid)

        # Verify hasattr works
        self.assertTrue(hasattr(bug, "id"))
        self.assertTrue(hasattr(bug, "bug_id"))

        self.assertEqual(bug.component, component)
        self.assertEqual(bug.version, version)
        self.assertEqual(bug.summary, summary)

        # Close the bug
        tests.clicomm("bugzilla modify --close NOTABUG %s" % bugid, bz)
        bug.refresh()
        self.assertEqual(bug.status, "CLOSED")
        self.assertEqual(bug.resolution, "NOTABUG")
开发者ID:crobinso,项目名称:python-bugzilla,代码行数:35,代码来源:rw_functional.py


示例2: test4NewBugAllFields

    def test4NewBugAllFields(self):
        """
        Create a bug using all 'new' fields, check some values, close it
        """
        bz = self.bzclass(url=self.url, cookiefile=cf, tokenfile=tf)

        summary = ("python-bugzilla test manyfields bug %s" %
                   datetime.datetime.today())
        url = "http://example.com"
        osval = "Windows"
        cc = "[email protected]"
        blocked = "461686,461687"
        dependson = "427301"
        comment = "Test bug from python-bugzilla test suite"
        sub_component = "Command-line tools (RHEL6)"
        alias = "pybz-%s" % datetime.datetime.today().strftime("%s")
        newout = tests.clicomm("bugzilla new "
            "--product 'Red Hat Enterprise Linux 6' --version 6.0 "
            "--component lvm2 --sub-component '%s' "
            "--summary \"%s\" "
            "--comment \"%s\" "
            "--url %s --severity Urgent --priority Low --os %s "
            "--arch ppc --cc %s --blocked %s --dependson %s "
            "--alias %s "
            "--outputformat \"%%{bug_id}\"" %
            (sub_component, summary, comment, url,
             osval, cc, blocked, dependson, alias), bz)

        self.assertTrue(len(newout.splitlines()) == 3)

        bugid = int(newout.splitlines()[2])
        bug = bz.getbug(bugid)
        print("\nCreated bugid: %s" % bugid)

        self.assertEquals(bug.summary, summary)
        self.assertEquals(bug.bug_file_loc, url)
        self.assertEquals(bug.op_sys, osval)
        self.assertEquals(bug.blocks, _split_int(blocked))
        self.assertEquals(bug.depends_on, _split_int(dependson))
        self.assertTrue(all([e in bug.cc for e in cc.split(",")]))
        self.assertEquals(bug.longdescs[0]["text"], comment)
        self.assertEquals(bug.sub_components, {"lvm2": [sub_component]})
        self.assertEquals(bug.alias, [alias])

        # Close the bug

        # RHBZ makes it difficult to provide consistent semantics for
        # 'alias' update:
        # https://bugzilla.redhat.com/show_bug.cgi?id=1173114
        # alias += "-closed"
        tests.clicomm("bugzilla modify "
            "--close WONTFIX %s " %
            bugid, bz)
        bug.refresh()
        self.assertEquals(bug.status, "CLOSED")
        self.assertEquals(bug.resolution, "WONTFIX")
        self.assertEquals(bug.alias, [alias])
开发者ID:atodorov,项目名称:python-bugzilla,代码行数:57,代码来源:rw_functional.py


示例3: testPositionalArgs

    def testPositionalArgs(self):
        # Make sure cli correctly rejects ambiguous positional args
        out = tests.clicomm("bugzilla login --xbadarg foo",
                None, expectfail=True)
        assert "unrecognized arguments: --xbadarg" in out

        out = tests.clicomm("bugzilla modify 123456 --foobar --status NEW",
                None, expectfail=True)
        assert "unrecognized arguments: --foobar" in out
开发者ID:python-bugzilla,项目名称:python-bugzilla,代码行数:9,代码来源:test_misc.py


示例4: clicomm

    def clicomm(self, argstr, expectexc=False, bz=None):
        comm = "bugzilla " + argstr

        if not bz:
            bz = Bugzilla(url=self.url, use_creds=False)
        if expectexc:
            with pytest.raises(Exception):
                tests.clicomm(comm, bz)
        else:
            return tests.clicomm(comm, bz)
开发者ID:python-bugzilla,项目名称:python-bugzilla,代码行数:10,代码来源:test_ro_functional.py


示例5: test03NewBugBasic

    def test03NewBugBasic(self):
        """
        Create a bug with minimal amount of fields, then close it
        """
        bz = self.bzclass(url=self.url)
        bug = self._makebug(bz)

        # Verify hasattr works
        assert hasattr(bug, "id")
        assert hasattr(bug, "bug_id")

        # Close the bug
        tests.clicomm("bugzilla modify --close NOTABUG %s" % bug.id, bz)
        bug.refresh()
        assert bug.status == "CLOSED"
        assert bug.resolution == "NOTABUG"
开发者ID:python-bugzilla,项目名称:python-bugzilla,代码行数:16,代码来源:test_rw_functional.py


示例6: testUnknownKeys

    def testUnknownKeys(self):
        """
        Make sure unknown key detection works
        """
        # Prevent unfinished crate support from interfering
        # pylint: disable=protected-access
        # Ignore 'Access to protected member'
        from scratchlivedb.scratchdb import _unknowns
        _unknowns.unknowns = {}
        # pylint: enable=protected-access

        out = tests.clicomm("scratchlivedb-tool dump %s" % unknowndb)
        assert "Unknown keys encountered: ['tzzz', 'uzzz', 'zzzz']" in out

        out = tests.clicomm("scratchlivedb-tool --debug dump %s" % unknowndb)
        assert "Unknown type for key 'zzzz'" in out
开发者ID:crobinso,项目名称:scratchlivedb,代码行数:16,代码来源:test_cli.py


示例7: test10Login

    def test10Login(self):
        """
        Failed login test, gives us a bit more coverage
        """
        # We overwrite getpass for testing
        import getpass

        def fakegetpass(prompt):
            sys.stdout.write(prompt)
            sys.stdout.flush()
            return sys.stdin.readline()

        oldgetpass = getpass.getpass
        getpass.getpass = fakegetpass

        try:
            # Implied login with --username and --password
            ret = tests.clicomm(
                "bugzilla --bugzilla %s " "--user [email protected] " "--password foobar query -b 123456" % self.url,
                None,
                expectfail=True,
            )
            self.assertTrue("Login failed: " in ret)

            # 'login' with explicit options
            ret = tests.clicomm(
                "bugzilla --bugzilla %s " "--user [email protected] " "--password foobar login" % self.url,
                None,
                expectfail=True,
            )
            self.assertTrue("Login failed: " in ret)

            # 'login' with positional options
            ret = tests.clicomm(
                "bugzilla --bugzilla %s " "login [email protected] foobar" % self.url, None, expectfail=True
            )
            self.assertTrue("Login failed: " in ret)

            # bare 'login'
            stdinstr = "[email protected]\n\rfoobar\n\r"
            ret = tests.clicomm("bugzilla --bugzilla %s login" % self.url, None, expectfail=True, stdinstr=stdinstr)
            self.assertTrue("Bugzilla Username:" in ret)
            self.assertTrue("Bugzilla Password:" in ret)
            self.assertTrue("Login failed: " in ret)
        finally:
            getpass.getpass = oldgetpass
开发者ID:colonelqubit,项目名称:python-bugzilla,代码行数:46,代码来源:rw_functional.py


示例8: test06ModifyEmails

    def test06ModifyEmails(self):
        """
        Modify cc, assignee, qa_contact for existing bug
        """
        bz = self.bzclass(url=self.url)
        bugid = "663674"
        cmd = "bugzilla modify %s " % bugid

        bug = bz.getbug(bugid)

        origcc = bug.cc

        # Test CC list and reset it
        email1 = "[email protected]"
        email2 = "[email protected]"
        bug.deletecc(origcc)
        tests.clicomm(cmd + "--cc %s --cc %s" % (email1, email2), bz)
        bug.addcc(email1)

        bug.refresh()
        self.assertTrue(email1 in bug.cc)
        self.assertTrue(email2 in bug.cc)
        self.assertEquals(len(bug.cc), 2)

        tests.clicomm(cmd + "--cc=-%s" % email1, bz)
        bug.refresh()
        self.assertTrue(email1 not in bug.cc)

        # Test assigned target
        tests.clicomm(cmd + "--assignee %s" % email1, bz)
        bug.refresh()
        self.assertEquals(bug.assigned_to, email1)

        # Test QA target
        tests.clicomm(cmd + "--qa_contact %s" % email1, bz)
        bug.refresh()
        self.assertEquals(bug.qa_contact, email1)

        # Reset values
        bug.deletecc(bug.cc)
        tests.clicomm(cmd + "--reset-qa-contact --reset-assignee", bz)

        bug.refresh()
        self.assertEquals(bug.cc, [])
        self.assertEquals(bug.assigned_to, "[email protected]")
        self.assertEquals(bug.qa_contact, "[email protected]")
开发者ID:hydro69,项目名称:python-bugzilla,代码行数:46,代码来源:rw_functional.py


示例9: clicomm

    def clicomm(self, argstr, expectexc=False):
        comm = "bugzilla " + argstr

        bz = self.bzclass(url=self.url, cookiefile=None, tokenfile=None)
        if expectexc:
            self.assertRaises(Exception, tests.clicomm, comm, bz)
        else:
            return tests.clicomm(comm, bz)
开发者ID:atodorov,项目名称:python-bugzilla,代码行数:8,代码来源:ro_functional.py


示例10: testCertFail

 def testCertFail(self):
     # No public setup that I know of to test cert succeeds, so
     # let's give it a bogus file and ensure it fails
     badcert = os.path.join(os.path.dirname(__file__), "..", "README.md")
     out = tests.clicomm(
         "bugzilla --cert %s query --bug_id 123456" % badcert,
         None, expectfail=True)
     assert "PEM" in out
开发者ID:python-bugzilla,项目名称:python-bugzilla,代码行数:8,代码来源:test_ro_functional.py


示例11: testFaults

    def testFaults(self):
        # Test special error wrappers in bugzilla/_cli.py
        bzinstance = Bugzilla(self.url, use_creds=False)
        out = tests.clicomm("bugzilla query --field=IDONTEXIST=FOO",
            bzinstance, expectfail=True)
        assert "Server error:" in out

        out = tests.clicomm("bugzilla "
            "--bugzilla https://example.com/xmlrpc.cgi "
            "query --field=IDONTEXIST=FOO", None, expectfail=True)
        assert "Connection lost/failed" in out

        out = tests.clicomm("bugzilla "
            "--bugzilla https://expired.badssl.com/ "
            "query --bug_id 1234", None, expectfail=True)
        assert "trust the remote server" in out
        assert "--nosslverify" in out
开发者ID:python-bugzilla,项目名称:python-bugzilla,代码行数:17,代码来源:test_ro_functional.py


示例12: clicomm

    def clicomm(self, argstr, out):
        comm = "bugzilla query --test-return-result " + argstr

        if out is None:
            self.assertRaises(RuntimeError, tests.clicomm, comm, self.bz)
        else:
            q = tests.clicomm(comm, self.bz, returnmain=True)
            self.assertDictEqual(out, q)
开发者ID:pombredanne,项目名称:python-bugzilla,代码行数:8,代码来源:query.py


示例13: test10Login

 def test10Login(self):
     """
     Failed login test, gives us a bit more coverage
     """
     ret = tests.clicomm("bugzilla --bugzilla %s "
                         "--user [email protected] "
                         "--password foobar login" % self.url, None,
                         expectfail=True)
     self.assertTrue("Login failed: " in ret)
开发者ID:atodorov,项目名称:python-bugzilla,代码行数:9,代码来源:rw_functional.py


示例14: test4NewBugAllFields

    def test4NewBugAllFields(self):
        """
        Create a bug using all 'new' fields, check some values, close it
        """
        bz = self.bzclass(url=self.url, cookiefile=cf)

        summary = ("python-bugzilla test manyfields bug %s" %
                   datetime.datetime.today())
        url = "http://example.com"
        osval = "Windows"
        cc = "[email protected]"
        blocked = "461686,461687"
        dependson = "427301"
        comment = "Test bug from python-bugzilla test suite"
        newout = tests.clicomm("bugzilla new "
            "--product Fedora --component python-bugzilla --version rawhide "
            "--summary \"%s\" "
            "--comment \"%s\" "
            "--url %s --severity Urgent --priority Low --os %s "
            "--arch ppc --cc %s --blocked %s --dependson %s "
            "--outputformat \"%%{bug_id}\"" %
            (summary, comment, url, osval, cc, blocked, dependson), bz)

        self.assertTrue(len(newout.splitlines()) == 3)

        bugid = int(newout.splitlines()[2])
        bug = bz.getbug(bugid)
        print "\nCreated bugid: %s" % bugid

        self.assertEquals(bug.summary, summary)
        self.assertEquals(bug.bug_file_loc, url)
        self.assertEquals(bug.op_sys, osval)
        self.assertEquals(bug.blocks, _split_int(blocked))
        self.assertEquals(bug.depends_on, _split_int(dependson))
        self.assertTrue(all([e in bug.cc for e in cc.split(",")]))
        self.assertEquals(bug.longdescs[0]["text"], comment)

        # Close the bug
        tests.clicomm("bugzilla modify --close WONTFIX %s" % bugid,
                      bz)
        bug.refresh()
        self.assertEquals(bug.status, "CLOSED")
        self.assertEquals(bug.resolution, "WONTFIX")
开发者ID:pombreda,项目名称:python-bugzilla,代码行数:43,代码来源:rw_functional.py


示例15: test9Whiteboards

    def test9Whiteboards(self):
        bz = self.bzclass(url=self.url, cookiefile=cf, tokenfile=tf)
        bug_id = "663674"
        cmd = "bugzilla modify %s " % bug_id
        bug = bz.getbug(bug_id)

        # Set all whiteboards
        initval = str(random.randint(1, 1024))
        tests.clicomm(cmd +
                "--whiteboard =%sstatus "
                "--devel_whiteboard =%sdevel "
                "--internal_whiteboard '=%sinternal, security, foo security1' "
                "--qa_whiteboard =%sqa " %
                (initval, initval, initval, initval), bz)

        bug.refresh()
        self.assertEquals(bug.whiteboard, initval + "status")
        self.assertEquals(bug.qa_whiteboard, initval + "qa")
        self.assertEquals(bug.devel_whiteboard, initval + "devel")
        self.assertEquals(bug.internal_whiteboard,
                          initval + "internal, security, foo security1")

        # Modify whiteboards
        tests.clicomm(cmd +
                      "--whiteboard =foobar "
                      "--qa_whiteboard _app ", bz)
        bug.prependwhiteboard("pre-", "devel")

        bug.refresh()
        self.assertEquals(bug.qa_whiteboard, initval + "qa" + " _app")
        self.assertEquals(bug.devel_whiteboard, "pre- " + initval + "devel")
        self.assertEquals(bug.status_whiteboard, "foobar")

        # Verify that tag manipulation is smart about separator
        tests.clicomm(cmd +
                      "--qa_whiteboard -_app "
                      "--internal_whiteboard -security", bz)
        bug.refresh()

        self.assertEquals(bug.qa_whiteboard, initval + "qa")
        self.assertEquals(bug.internal_whiteboard,
                          initval + "internal, foo security1")

        bug.addtag("teststuff", "internal")
        bug.refresh()
        self.assertEquals(bug.internal_whiteboard,
                          initval + "internal, foo security1, teststuff")


        # Clear whiteboards
        bug.setwhiteboard("", "status")
        bug.setwhiteboard("", "qa")
        bug.setwhiteboard("", "devel")
        bug.setwhiteboard("", "internal")

        bug.refresh()
        self.assertEquals(bug.whiteboard, "")
        self.assertEquals(bug.qa_whiteboard, "")
        self.assertEquals(bug.devel_whiteboard, "")
        self.assertEquals(bug.internal_whiteboard, "")
开发者ID:atodorov,项目名称:python-bugzilla,代码行数:60,代码来源:rw_functional.py


示例16: test16ModifyTags

    def test16ModifyTags(self):
        bugid = "461686"
        cmd = "bugzilla modify %s " % bugid
        bz = self.bzclass(url=self.url)
        bug = bz.getbug(bugid)

        if bug.tags:
            bz.update_tags(bug.id, tags_remove=bug.tags)
            bug.refresh()
            self.assertEquals(bug.tags, [])

        tests.clicomm(cmd + "--tags foo --tags +bar --tags baz", bz)
        bug.refresh()
        self.assertEquals(bug.tags, ["foo", "bar", "baz"])

        tests.clicomm(cmd + "--tags=-bar", bz)
        bug.refresh()
        self.assertEquals(bug.tags, ["foo", "baz"])

        bz.update_tags(bug.id, tags_remove=bug.tags)
        bug.refresh()
        self.assertEquals(bug.tags, [])
开发者ID:hydro69,项目名称:python-bugzilla,代码行数:22,代码来源:rw_functional.py


示例17: clicomm

    def clicomm(self, argstr, out, wbout=None, tags_add=None, tags_rm=None):
        comm = "bugzilla modify --__test-return-result 123456 224466 " + argstr

        (mdict, wdict, tagsa, tagsr) = tests.clicomm(
            comm, self.bz, returnmain=True)

        if wbout:
            assert wbout == wdict
        if out:
            assert out == mdict
        if tags_add:
            assert tags_add == tagsa
        if tags_rm:
            assert tags_rm == tagsr
开发者ID:python-bugzilla,项目名称:python-bugzilla,代码行数:14,代码来源:test_modify.py


示例18: clicomm

    def clicomm(self, argstr, out, flagsout=None, wbout=None):
        comm = "bugzilla modify --test-return-result 123456 224466 " + argstr

        if out is None:
            self.assertRaises(RuntimeError, tests.clicomm, comm, self.bz)
        else:
            (mdict, fdict, wdict) = tests.clicomm(comm,
                                                  self.bz, returnmain=True)
            if wbout:
                self.assertDictEqual(wbout, wdict)
            if flagsout:
                self.assertEqual(flagsout, fdict)
            if out:
                self.assertDictEqual(out, mdict)
开发者ID:pombredanne,项目名称:python-bugzilla,代码行数:14,代码来源:modify.py


示例19: testManPageGeneration

    def testManPageGeneration(self):
        try:
            # If logilab found, we get some useless import warning
            import warnings
            warnings.simplefilter("ignore")

            from logilab.common.optik_ext import ManHelpFormatter
            ignore = ManHelpFormatter
        except Exception:
            e = sys.exc_info()[1]
            print("Skipping man page test: %s" % e)
            return

        out = tests.clicomm("bugzilla --generate-man", None)
        self.assertTrue(len(out.splitlines()) > 100)
开发者ID:pombredanne,项目名称:python-bugzilla,代码行数:15,代码来源:misc.py


示例20: test09Whiteboards

    def test09Whiteboards(self):
        bz = self.bzclass(url=self.url)
        bug_id = "663674"
        cmd = "bugzilla modify %s " % bug_id
        bug = bz.getbug(bug_id)

        # Set all whiteboards
        initval = str(random.randint(1, 1024))
        tests.clicomm(cmd +
                "--whiteboard =%sstatus "
                "--devel_whiteboard =%sdevel "
                "--internal_whiteboard '=%sinternal, security, foo security1' "
                "--qa_whiteboard =%sqa " %
                (initval, initval, initval, initval), bz)

        bug.refresh()
        self.assertEquals(bug.whiteboard, initval + "status")
        self.assertEquals(bug.qa_whiteboard, initval + "qa")
        self.assertEquals(bug.devel_whiteboard, initval + "devel")
        self.assertEquals(bug.internal_whiteboard,
                          initval + "internal, security, foo security1")

        # Modify whiteboards
        tests.clicomm(cmd +
                      "--whiteboard =foobar "
                      "--qa_whiteboard _app "
                      "--devel_whiteboard =pre-%s" % bug.devel_whiteboard, bz)

        bug.refresh()
        self.assertEquals(bug.qa_whiteboard, initval + "qa" + " _app")
        self.assertEquals(bug.devel_whiteboard, "pre-" + initval + "devel")
        self.assertEquals(bug.status_whiteboard, "foobar")

        # Verify that tag manipulation is smart about separator
        tests.clicomm(cmd +
                      "--qa_whiteboard=-_app "
                      "--internal_whiteboard=-security,", bz)
        bug.refresh()

        self.assertEquals(bug.qa_whiteboard, initval + "qa")
        self.assertEquals(bug.internal_whiteboard,
                          initval + "internal, foo security1")

        # Clear whiteboards
        update = bz.build_update(
            whiteboard="", devel_whiteboard="",
            internal_whiteboard="", qa_whiteboard="")
        bz.update_bugs(bug.id, update)

        bug.refresh()
        self.assertEquals(bug.whiteboard, "")
        self.assertEquals(bug.qa_whiteboard, "")
        self.assertEquals(bug.devel_whiteboard, "")
        self.assertEquals(bug.internal_whiteboard, "")
开发者ID:hydro69,项目名称:python-bugzilla,代码行数:54,代码来源:rw_functional.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tests.create_authorization_header函数代码示例发布时间:2022-05-27
下一篇:
Python tests.assert_raises函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap