Ejemplo n.º 1
0
 def test_update_status(self):
     #__update_status(jobid, status, results, clear=False)
     #test the update operation
     self.enter_some_data(self.new_jobids)
     db_results = jobthing.get_open_ids()
     #some assertions
     for job in self.new_jobids:
         for job_id,job_pack in job.iteritems():
             assert db_results.has_key(job_id) == True
             assert db_results[job_id] == job_pack[0]
Ejemplo n.º 2
0
 def test_update_status(self):
     #__update_status(jobid, status, results, clear=False)
     #test the update operation
     self.enter_some_data(self.new_jobids)
     db_results = jobthing.get_open_ids()
     #some assertions
     for job in self.new_jobids:
         for job_id, job_pack in job.iteritems():
             assert db_results.has_key(job_id) == True
             assert db_results[job_id] == job_pack[0]
Ejemplo n.º 3
0
    def test_old_new_upgrade(self):
        #that will do some control if some users has old_ids and
        #upgrade to new ones so they shouldnt have some weird errors
        old_type_new = []
        old_type_old = []
        #create 5 old type job ids with current time
        for n in xrange(5):
            job_id = pprint.pformat(time.time())
            tmp_hash = {}
            tmp_hash[job_id] = (self.status_opt[randint(
                0,
                len(self.status_opt) - 1)], {
                    "some_old_type_new.com": self.test_result
                })
            old_type_new.append(tmp_hash)

        #create 5 old type job ids with older  time
        base_time = self.an_old_time
        for n in xrange(5):
            job_id = str(base_time)
            tmp_hash = {}
            tmp_hash[job_id] = (self.status_opt[randint(
                0,
                len(self.status_opt) - 1)], {
                    "some_old_type.com": self.test_result
                })
            old_type_old.append(tmp_hash)
            base_time = base_time + 10

        #print "The old type pack is : ",old_type_new
        #print "The old type pack is : ",old_type_old
        #enter also that ids into database
        self.enter_some_data(old_type_new)
        self.enter_some_data(old_type_old)
        #db_results = jobthing.get_open_ids()
        #print "The current db results are : ",db_results

        self.enter_some_data(self.new_jobids)
        self.enter_some_data(self.old_jobids)

        #db_results = jobthing.get_open_ids()
        #print "The current db results are : ",db_results

        #now check for errors or failures
        jobthing.purge_old_jobs()
        db_results = jobthing.get_open_ids()
        #print "The current db results are : ",db_results
        assert len(db_results.keys()) == len(self.new_jobids)
        for job in self.new_jobids:
            for job_id, job_pack in job.iteritems():
                assert db_results.has_key(job_id) == True
                assert db_results[job_id] == job_pack[0]
Ejemplo n.º 4
0
    def test_purge_old_jobs(self):
        #purge_old_jobs()
        self.enter_some_data(self.new_jobids)
        self.enter_some_data(self.old_jobids)
        #delete the olders
        jobthing.purge_old_jobs()
        db_results = jobthing.get_open_ids()
        #print "The lenght of the db result is : ",len(db_results.keys())
        assert len(db_results.keys()) == len(self.new_jobids)

        for job in self.new_jobids:
            for job_id,job_pack in job.iteritems():
                assert db_results.has_key(job_id) == True
                assert db_results[job_id] == job_pack[0]
        self.enter_some_data(self.old_jobids)
        jobthing.purge_old_jobs()
        assert len(db_results.keys()) == len(self.new_jobids)
Ejemplo n.º 5
0
    def test_purge_old_jobs(self):
        #purge_old_jobs()
        self.enter_some_data(self.new_jobids)
        self.enter_some_data(self.old_jobids)
        #delete the olders
        jobthing.purge_old_jobs()
        db_results = jobthing.get_open_ids()
        #print "The lenght of the db result is : ",len(db_results.keys())
        assert len(db_results.keys()) == len(self.new_jobids)

        for job in self.new_jobids:
            for job_id, job_pack in job.iteritems():
                assert db_results.has_key(job_id) == True
                assert db_results[job_id] == job_pack[0]
        self.enter_some_data(self.old_jobids)
        jobthing.purge_old_jobs()
        assert len(db_results.keys()) == len(self.new_jobids)
Ejemplo n.º 6
0
    def test_old_new_upgrade(self):
        #that will do some control if some users has old_ids and
        #upgrade to new ones so they shouldnt have some weird errors
        old_type_new = []
        old_type_old = []
        #create 5 old type job ids with current time
        for n in xrange(5):
            job_id = pprint.pformat(time.time())
            tmp_hash = {}
            tmp_hash[job_id] = (self.status_opt[randint(0,len(self.status_opt)-1)],{"some_old_type_new.com":self.test_result})
            old_type_new.append(tmp_hash)
        
        #create 5 old type job ids with older  time
        base_time = self.an_old_time
        for n in xrange(5):
            job_id = str(base_time)
            tmp_hash = {}
            tmp_hash[job_id] = (self.status_opt[randint(0,len(self.status_opt)-1)],{"some_old_type.com":self.test_result})
            old_type_old.append(tmp_hash)
            base_time = base_time + 10
        
        #print "The old type pack is : ",old_type_new
        #print "The old type pack is : ",old_type_old
        #enter also that ids into database
        self.enter_some_data(old_type_new)
        self.enter_some_data(old_type_old)
        #db_results = jobthing.get_open_ids()
        #print "The current db results are : ",db_results

        self.enter_some_data(self.new_jobids)
        self.enter_some_data(self.old_jobids)
        
        #db_results = jobthing.get_open_ids()
        #print "The current db results are : ",db_results

        #now check for errors or failures
        jobthing.purge_old_jobs()
        db_results = jobthing.get_open_ids()
        #print "The current db results are : ",db_results
        assert len(db_results.keys()) == len(self.new_jobids)
        for job in self.new_jobids:
            for job_id,job_pack in job.iteritems():
                assert db_results.has_key(job_id) == True
                assert db_results[job_id] == job_pack[0]