Beispiel #1
0
    def test_all_plugins_snapshot(self):
        tmpdir = tempfile.mkdtemp(prefix='citellus-tmp')

        # Setup folder for all tests
        testtype = 'pass'
        for test in uttest:
            subprocess.call([test, test, testtype, tmpdir])

        # Run citellus once against them
        results = citellus.docitellus(path=tmpdir, plugins=citplugs)

        # Remove tmp folder
        shutil.rmtree(tmpdir)

        # Process plugin output from multiple plugins
        new_dict = []
        for item in results:
            rc = item['result']['rc']
            if rc not in sorted(
                    set([
                        citellus.RC_OKAY, citellus.RC_FAILED,
                        citellus.RC_SKIPPED
                    ])):
                print(item)
            assert rc in sorted(
                set([
                    citellus.RC_OKAY, citellus.RC_FAILED, citellus.RC_SKIPPED
                ]))
            new_dict.append(rc)

        assert sorted(set(new_dict)) == sorted(
            set([citellus.RC_OKAY, citellus.RC_FAILED, citellus.RC_SKIPPED]))
Beispiel #2
0
    def test_all_plugins_live(self):
        # Run citellus once against them
        results = citellus.docitellus(live=True, plugins=citplugs)

        # Process plugin output from multiple plugins
        new_dict = []
        for item in results:
            rc = item['result']['rc']
            if rc not in sorted(
                    set([
                        citellus.RC_OKAY, citellus.RC_FAILED,
                        citellus.RC_SKIPPED
                    ])):
                print(item)
            assert rc in sorted(
                set([
                    citellus.RC_OKAY, citellus.RC_FAILED, citellus.RC_SKIPPED
                ]))
            if rc == citellus.RC_FAILED or rc == citellus.RC_SKIPPED:
                print(item)
                assert item['result']['err'] != ""

            new_dict.append(rc)

        assert sorted(set(new_dict)) == sorted(
            set([citellus.RC_OKAY, citellus.RC_FAILED, citellus.RC_SKIPPED]))
def runtest(testtype='False'):
    # testtype will be 'pass', 'fail', 'skipped'

    # We're iterating against the different UT tests defined in UT-tests folder
    tmpdir = tempfile.mkdtemp(prefix='citellus-tmp')

    # Setup test for 'testtype'
    subprocess.check_output([uttest, uttest, testtype, tmpdir])

    # Run test against it
    res = citellus.docitellus(path=tmpdir, plugins=citplugs)

    # Get Return code
    rc = res[0]['result']['rc']

    # Remove tmp folder
    shutil.rmtree(tmpdir)

    # Check if it passed
    return rc
Beispiel #4
0
 def test_docitellus(self):
     plugins = citellus.findplugins([testplugins], include=['exit_passed'])
     results = citellus.docitellus(plugins=plugins)
     assert len(results) == 1
     assert results[0]['result']['rc'] == citellus.RC_OKAY