def test_missing_charset(self): msg = email.message_from_file(open("test-data/job-email-missing-charset")) self.assertTrue(msg) self.assertTrue(miner.is_job_email(msg)) j = miner.email_to_job(msg) self.assertTrue(j) self.assertEqual(j.title, "Job Posting: Programmer/Analyst 2, The University of Chicago Library")
def test_email_to_job(self): # need a keyword/subject mapping to test auto-tagging kw = Keyword.objects.create(name="drupal") su = Subject.objects.create(name="Drupal") su.keywords.add(kw) su.save() msg = email.message_from_file(open("test-data/job-email")) j = miner.email_to_job(msg) self.assertTrue(type(j), Job) self.assertEqual(j.contact_name, 'Cheryl A. Gowing') self.assertEqual(j.contact_email, "*****@*****.**") self.assertEqual(j.title, 'Job Posting: Head of Web & Emerging Technologies, University of Miami - revised') self.assertTrue('collaborates' in j.description) self.assertTrue(j.email_message_id, '<*****@*****.**>') subjects = [s.name for s in j.subjects.all()] self.assertTrue('Drupal' in subjects)
def test_email_to_job(self): # need a keyword/subject mapping to test auto-tagging kw = Keyword.objects.create(name="drupal") su = Subject.objects.create(name="Drupal") su.keywords.add(kw) su.save() msg = email.message_from_file(open("test-data/job-email")) j = miner.email_to_job(msg) self.assertTrue(type(j), Job) self.assertEqual(j.contact_name, "Cheryl A. Gowing") self.assertEqual(j.contact_email, "*****@*****.**") self.assertEqual(j.title, "Job Posting: Head of Web & Emerging Technologies, University of Miami - revised") self.assertTrue("collaborates" in j.description) self.assertTrue(j.email_message_id, "<*****@*****.**>") subjects = [s.name for s in j.subjects.all()] self.assertTrue("Drupal" in subjects)
def test_multipart(self): msg = email.message_from_file(open("test-data/job-multipart-email")) j = miner.email_to_job(msg) self.assertEqual(j.title, "Library System Administrator Position")