Example #1
0
"""

__author__ = 'Fergus Henderson'

import testdistcc
import comfychair
import sys

if __name__ == '__main__':
    while len(sys.argv) > 1 and sys.argv[1].startswith("--"):
        if sys.argv[1] == "--valgrind":
            testdistcc._valgrind_command = "valgrind --quiet "
            del sys.argv[1]
        elif sys.argv[1].startswith("--valgrind="):
            testdistcc._valgrind_command = sys.argv[1][len("--valgrind="
                                                           ):] + " "
            del sys.argv[1]
        elif sys.argv[1] == "--lzo":
            testdistcc._server_options = ",lzo"
            del sys.argv[1]
        elif sys.argv[1] == "--pump":
            testdistcc._server_options = ",lzo,cpp"
            del sys.argv[1]

    if len(sys.argv) > 1:
        testname = sys.argv[1]
        del sys.argv[1]
        comfychair.main([eval('testdistcc.' + testname)])
    else:
        sys.exit(__doc__)
Example #2
0

class NormalTest(comfychair.TestCase):
    def runtest(self):
        pass


class RootTest(comfychair.TestCase):
    def setup(self):
        self.require_root()

    def runTest(self):
        pass


class GoodExecTest(comfychair.TestCase):
    def runtest(self):
        stdout = self.runcmd("ls -l")


class BadExecTest(comfychair.TestCase):
    def setup(self):
        exit, stdout = self.runcmd_unchecked("spottyfoot --slobber",
                                             skip_on_noexec=1)


tests = [NormalTest, RootTest, GoodExecTest, BadExecTest]

if __name__ == '__main__':
    comfychair.main(tests)
                qualifiers={'ASSOCIATION': CIMQualifier('ASSOCIATION', True)}))


class ParseRoundtripInstance(RoundTripTest):
    def runtest(self):

        self.test(CIMInstance('CIM_Foo'))
        self.test(CIMInstance('CIM_Foo', {'InstanceID': '1234'}))


#################################################################
# Main function
#################################################################

tests = [

    # Parse specific bits of XML
    ParseXMLKeyvalue,
    ParseXMLInstancename,
    ParseXMLValue,
    ParseXMLValueArray,
    ParseXMLQualifier,
    ParseXMLProperty,

    # Round trip tests
    ParseRoundtripInstance,
]

if __name__ == '__main__':
    main(tests)
    # Message elements

    Message,                            # MESSAGE
    MultiReq,                           # MULTIREQ
    MultiExpReq,                        # MULTIEXPREQ
    SimpleReq,                          # SIMPLEREQ
    SimpleExpReq,                       # SIMPLEEXPREQ
    IMethodCall,                        # IMETHODCALL
    MethodCall,                         # METHODCALL
    ExpMethodCall,                      # EXPMETHODCALL
    ParamValue,                         # PARAMVALUE
    IParamValue,                        # IPARAMVALUE
    ExpParamValue,                      # EXPPARAMVALUE
    MultiRsp,                           # MULTIRSP
    MultiExpRsp,                        # MULTIEXPRSP
    SimpleRsp,                          # SIMPLERSP
    SimpleExpRsp,                       # SIMPLEEXPRSP
    MethodResponse,                     # METHODRESPONSE
    ExpMethodResponse,                  # EXPMETHODRESPONSE
    IMethodResponse,                    # IMETHODRESPONSE
    Error,                              # ERROR
    ReturnValue,                        # RETURNVALUE
    IReturnValue,                       # IRETURNVALUE
    ResponseDestination,                # RESPONSEDESTINATION
    SimpleReqAck,                       # SIMPLEREQACK
    ]

if __name__ == '__main__':
    comfychair.main(tests)
Example #5
0
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
"""example of using ComfyChair"""

import comfychair


class OnePlusOne(comfychair.TestCase):
    def runtest(self):
        self.assert_(1 + 1 == 2)


class FailTest(comfychair.TestCase):
    def runtest(self):
        self.assert_(1 + 1 == 3)


tests = [OnePlusOne]
extra_tests = [FailTest]

if __name__ == '__main__':
    comfychair.main(tests, extra_tests=extra_tests)
Example #6
0
TESTNAME should be the name of one of the test cases from testdistcc.py.
"""

__author__ = 'Fergus Henderson'

import testdistcc
import comfychair
import sys

if __name__ == '__main__':
  while len(sys.argv) > 1 and sys.argv[1].startswith("--"):
    if sys.argv[1] == "--valgrind":
      testdistcc._valgrind_command = "valgrind --quiet "
      del sys.argv[1]
    elif sys.argv[1].startswith("--valgrind="):
      testdistcc._valgrind_command = sys.argv[1][len("--valgrind="):] + " "
      del sys.argv[1]
    elif sys.argv[1] == "--lzo":
      testdistcc._server_options = ",lzo"
      del sys.argv[1]
    elif sys.argv[1] == "--pump":
      testdistcc._server_options = ",lzo,cpp"
      del sys.argv[1]

  if len(sys.argv) > 1:
    testname = sys.argv[1]
    del sys.argv[1]
    comfychair.main([eval('testdistcc.' + testname)])
  else:
    sys.exit(__doc__)
        self.test(
            '<KEYVALUE VALUETYPE="numeric">1234</KEYVALUE>',
            1234)

        self.test(
            '<KEYVALUE TYPE="uint32" VALUETYPE="numeric">1234</KEYVALUE>',
            1234)

#################################################################
# Main function
#################################################################

tests = [

    # "Round trip" parsing functions

    ParseCIMInstanceName,
    ParseCIMInstance,
    ParseCIMClass,
    ParseCIMProperty,
    ParseCIMParameter,

    # Parse specific bits of XML

    ParseXMLKeyValue,
    
    ]

if __name__ == '__main__':
    main(tests)
Example #8
0
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.


"""example of using ComfyChair"""

import comfychair


class OnePlusOne(comfychair.TestCase):
    def runtest(self):
        self.assert_(1 + 1 == 2)


class FailTest(comfychair.TestCase):
    def runtest(self):
        self.assert_(1 + 1 == 3)


tests = [OnePlusOne]
extra_tests = [FailTest]

if __name__ == "__main__":
    comfychair.main(tests, extra_tests=extra_tests)