def test_find_all(self): self.job_item.save() another_job_item = JobItem() another_job_item.job_title = "Another Test Job" another_job_item.save() records = JobItem.findall() print "Job Items", records self.assertEqual(2, len(records))
def test_find_all(self): self.job_item.save() another_job_item = JobItem() another_job_item.job_title = 'Another Test Job' another_job_item.save() records = JobItem.findall() print 'Job Items', records self.assertEqual(2, len(records))
def test_find_with_pagination(self): for i in range(0, 20): job_item = JobItem() job_item.job_title = "job_item_%d" % i job_item.save() records = JobItem.find_with_pagination(page_request={"page_no": 2, "size": 10}) print "Job Items", records self.assertEqual(10, len(records))
def test_find_with_pagination(self): for i in range(0, 20): job_item = JobItem() job_item.job_title='job_item_%d' % i job_item.save() records = JobItem.find_with_pagination(page_request={'page_no': 2, 'size': 10}) print 'Job Items', records self.assertEqual(10, len(records))
def test_remove_records_matches_rejection_pattern(self): for i in range(0, 20): job_item = JobItem() job_item.job_title = u"人员_%d" % i job_item.save() # mark the title as blocked RejectionPattern(u"人员_\d+", "For Testing").save() # run the remove action JobItem.remove_records_matches_rejection_pattern() conn = self.connect_db() try: c = conn.cursor() c.execute("SELECT COUNT(*) FROM " + JobItem.table_name) self.assertEqual(c.fetchone()[0], 0, "Count of job items should be 0") except: pass finally: conn.close()
def test_remove_records_matches_rejection_pattern(self): for i in range(0, 20): job_item = JobItem() job_item.job_title=u'人员_%d' % i job_item.save() # mark the title as blocked RejectionPattern(u'人员_\d+', 'For Testing').save() # run the remove action JobItem.remove_records_matches_rejection_pattern() conn = self.connect_db() try: c = conn.cursor() c.execute('SELECT COUNT(*) FROM ' + JobItem.table_name) self.assertEqual(c.fetchone()[0], 0, 'Count of job items should be 0') except: pass finally: conn.close()
def test_remove_blocked_records(self): for i in range(0, 20): job_item = JobItem() job_item.job_title = u"人员_%d" % i job_item.contact = str(random.randint(90000000, 99999999)) job_item.save() # mark the contact as blocked BlockedContact(job_item.contact, u"人员").save() # run the remove action JobItem.remove_blocked_records() conn = self.connect_db() try: c = conn.cursor() c.execute("SELECT COUNT(*) FROM " + JobItem.table_name) self.assertEqual(c.fetchone()[0], 0, "Count of job items should be 0") except: pass finally: conn.close()
def test_remove_blocked_records(self): for i in range(0, 20): job_item = JobItem() job_item.job_title=u'人员_%d' % i job_item.contact = str(random.randint(90000000, 99999999)) job_item.save() # mark the contact as blocked BlockedContact(job_item.contact, u'人员').save() # run the remove action JobItem.remove_blocked_records() conn = self.connect_db() try: c = conn.cursor() c.execute('SELECT COUNT(*) FROM ' + JobItem.table_name) self.assertEqual(c.fetchone()[0], 0, 'Count of job items should be 0') except: pass finally: conn.close()