import unittest

class Test(unittest.TestCase):

    def setUp(self):
        self.seq = range(10)

    #def test_shuffle(self):
    #    # make sure the shuffled sequence does not lose any elements
    #    random.shuffle(self.seq)
    #    self.seq.sort()
    #    self.assertEqual(self.seq, range(10))

    #def test_choice(self):
    #    element = random.choice(self.seq)
    #    self.assertTrue(element in self.seq)

    #def test_sample(self):
    #    self.assertRaises(ValueError, random.sample, self.seq, 20)
    #    for element in random.sample(self.seq, 5):
    #        self.assertTrue(element in self.seq)

if __name__ == '__main__':
    unittest.main()

@@ -8,16 +8,78 @@
 unittest
+, xmlrpclib, couchdb%0Afrom ConfigParser import SafeConfigParser
 %0A%0Aclass 
@@ -142,163 +142,701 @@
 elf.
-seq = range(10)%0A%0A    #def test_shuffle(self):
+cfg = SafeConfigParser()%0A        self.cfg.read(('rpc_client.ini', '../stats/basicStats.ini'))%0A        host = self.cfg.get('connection', 'server')%0A        port = self.cfg.getint('connection', 'port')%0A        connString = 'http://%25s:%25i' %25 (host, port)
 %0A    
-#
     
-# make sure the shuffled sequence does not lose any elements
+self.sp = xmlrpclib.ServerProxy(connString)%0A        self.projName = 'test_project_abracadabra'%0A%0A%0A    def test_projectExists(self):%0A        self.assertFalse( self.sp.projectExists(self.projName) )%0A        %0A        %0A    def test_createAndDeleteProject(self):%0A        self.assertFalse( self.sp.projectExists(self.projName) )
 %0A    
-#
     
-random.shuffle(self.seq
+self.sp.createProject(self.projName)%0A        self.assertTrue( self.sp.projectExists(self.projName) 
 )%0A    
-#
     
@@ -845,23 +845,43 @@
 lf.s
-eq.sort(
+p.deleteProject(self.projName
 )%0A    
-#
     
@@ -895,41 +895,67 @@
 sert
-Equal(self.seq, range(10))%0A
+False( self.sp.projectExists(self.projName) )%0A        
 %0A    
-#
 def 
@@ -960,21 +960,26 @@
 f test_c
-hoice
+reateViews
 (self):%0A
@@ -986,52 +986,106 @@
     
-#
     
-element = random.choice(self.seq
+if self.sp.projectExists(self.projName):%0A            self.sp.createProject(self.projName
 )%0A    
-#
     
@@ -1099,68 +1099,217 @@
 sert
-True(element in self.seq)%0A%0A    #def test_sample(self):
+False( self.sp.projectExists(self.projName) )%0A        self.sp.createProject(self.projName)%0A        %0A        server = couchdb.Server(self.cfg.get('couchdb', 'dbaddress'))%0A        db = server%5Bself.projName%5D
 %0A    
-#
     
@@ -1323,157 +1323,422 @@
 sert
-Raises(ValueError, random.sample, self.seq, 20
+True('_design/manage' in db)%0A        self.assertTrue('_design/basicStats' in db)%0A        self.assertTrue('jobs' in db%5B'_design/manage'%5D%5B'views'%5D)%0A        self.assertTrue('addCar' in db%5B'_design/basicStats'%5D%5B'views'%5D
 )%0A    
-#
     
-for element in random.sample(self.seq, 5):%0A    #        self.assertTrue(element in self.seq)
+self.assertTrue('deleteCar' in db%5B'_design/basicStats'%5D%5B'views'%5D)%0A        %0A        self.sp.deleteProject(self.projName)%0A        self.assertFalse( self.sp.projectExists(self.projName) )%0A    
 %0A%0Aif

Make some simple unit test for RPC server.