Ejemplo n.º 1
0
class ClientTest(unittest.TestCase):
    # TODO: WOrk out how to mock the server for stand alone testing
    def setUp(self):
        self.client = Handler()
        logging.basicConfig(level=logging.DEBUG)
        self.client.logger = logging.getLogger('CRAB3 client tests')

    def tearDown(self):
        """
        Standard tearDown

        """

        #os.system('rm -rf crab_%s' % testConfig.General.requestName)
        pass

    def testBadCommand(self):
        """
        Test executing a command that doesn't exist, make sure a KeyError
        is raised and that the return code is 1
        """
        commando = 'foo'
        self.client.loadConfig(testConfig)

        self.assertRaises(KeyError, self.client, commando, {})

    def testNoServer(self):
        """
        For each command that interacts with the server make sure that a
        socket error is raised when the server isn't present.
        """
        self.client.loadConfig(testConfig)
        #        self.client.initialise('submit')

        self.assertRaises(socket.error, self.client, 'status', {})
Ejemplo n.º 2
0
class ClientTest(unittest.TestCase):
    # TODO: WOrk out how to mock the server for stand alone testing
    def setUp(self):
        self.client = Handler()
        logging.basicConfig(level=logging.DEBUG)
        self.client.logger = logging.getLogger('CRAB3 client tests')

    def tearDown(self):
        """
        Standard tearDown

        """

        #os.system('rm -rf crab_%s' % testConfig.General.requestName)
        pass

    def testBadCommand(self):
        """
        Test executing a command that doesn't exist, make sure a KeyError
        is raised and that the return code is 1
        """
        commando = 'foo'
        self.client.loadConfig(testConfig)

        self.assertRaises(KeyError, self.client, commando, {})

    def testNoServer(self):
        """
        For each command that interacts with the server make sure that a
        socket error is raised when the server isn't present.
        """
        self.client.loadConfig(testConfig)
#        self.client.initialise('submit')

        self.assertRaises(socket.error, self.client, 'status', {})
Ejemplo n.º 3
0
 def setUp(self):
     self.client = Handler()
     logging.basicConfig(level=logging.DEBUG)
     self.client.logger = logging.getLogger('CRAB3 client tests')
Ejemplo n.º 4
0
 def setUp(self):
     self.client = Handler()
     logging.basicConfig(level=logging.DEBUG)
     self.client.logger = logging.getLogger('CRAB3 client tests')