def test_get_pdf_ull_filter_by_date(self): user = UserFactory.create() user.profile.rrhh_code = 'example_code' user.profile.documento = 'example_codeL' pdf = CVN.get_user_pdf_ull(user=user) cvn = CVN(user=user, pdf=pdf) cvn.xml_file.open() self.assertEqual(len(etree.parse(cvn.xml_file).findall('CvnItem')), 3) pdf = CVN.get_user_pdf_ull(user=user) cvn = CVN(user=user, pdf=pdf) cvn.xml_file.open() self.assertEqual(len(etree.parse(cvn.xml_file).findall('CvnItem')), 3) pdf = CVN.get_user_pdf_ull( user=user, start_date=datetime.date(2012, 1, 1)) cvn = CVN(user=user, pdf=pdf) cvn.xml_file.open() self.assertEqual(len(etree.parse(cvn.xml_file).findall('CvnItem')), 1) pdf = CVN.get_user_pdf_ull( user=user, end_date=datetime.date(2010, 1, 1)) cvn = CVN(user=user, pdf=pdf) cvn.xml_file.open() self.assertEqual(len(etree.parse(cvn.xml_file).findall('CvnItem')), 2) pdf = CVN.get_user_pdf_ull( user=user, start_date=datetime.date(2006, 1, 1), end_date=datetime.date(2011, 1, 1)) cvn = CVN(user=user, pdf=pdf) cvn.xml_file.open() self.assertEqual(len(etree.parse(cvn.xml_file).findall('CvnItem')), 2)
def test_get_pdf_ull_cargos(self): user = UserFactory.create() user.profile.rrhh_code = 'example_code' user.profile.documento = 'example_codeL' pdf = CVN.get_user_pdf_ull(user=user) cvn = CVN(user=user, pdf=pdf) cvn.xml_file.open() cvn_items = etree.parse(cvn.xml_file).findall('CvnItem') ws_content = CachedWS.get(st.WS_ULL_CARGOS % 'example_code') for w in ws_content: CVN._clean_data_profession(w) if not u'employer' in w: w[u'employer'] = u'Universidad de La Laguna' pdf_content = [] for item in cvn_items: pdf_content.append(parse_cvnitem(item)) self.assertEqual(len(ws_content), len(pdf_content)) allequal = True for wi in ws_content: equal = False for pi in pdf_content: if cmp(wi, pi) == 0: equal = True if not equal: allequal = False self.assertTrue(allequal)
def test_get_pdf_ull_learning(self): user = UserFactory.create() user.profile.rrhh_code = 'example_code' user.profile.documento = 'example_codeL' pdf = CVN.get_user_pdf_ull(user=user) cvn = CVN(user=user, pdf=pdf) cvn.xml_file.open() cvn_items = etree.parse(cvn.xml_file).findall('CvnItem') ws_content = CachedWS.get(st.WS_ULL_LEARNING % 'example_code') for w in ws_content: CVN._clean_data_learning(w) if u'des1_grado_titulacion' in w: w[u'des1_grado_titulacion'] = w[u'des1_grado_titulacion'].upper() if w[u'des1_grado_titulacion'] == u'DOCTOR': del w[u'des1_grado_titulacion'] pdf_content = [] for item in cvn_items: pdf_content.append(parse_cvnitem(item)) self.assertEqual(len(ws_content), len(pdf_content)) allequal = True for wi in ws_content: equal = False for pi in pdf_content: if cmp(wi, pi) == 0: equal = True if not equal: allequal = False self.assertTrue(allequal)
def _get_one_cargo_ull(self): user = UserFactory.create() user.profile.rrhh_code = 'example_code' user.profile.documento = 'example_codeL' pdf = CVN.get_user_pdf_ull(user=user) cvn = CVN(user=user, pdf=pdf) cvn.xml_file.open() cvn_items = etree.parse(cvn.xml_file).findall('CvnItem') self.assertEqual(len(cvn_items), 1) item = parse_cvnitem(cvn_items[0]) ws_content = CachedWS.get(st.WS_ULL_CARGOS % 'example_code') self.assertEqual(len(ws_content), 1) w = ws_content[0] CVN._clean_data_profession(w) if not u'employer' in w: w[u'employer'] = u'Universidad de La Laguna' self.assertEqual(cmp(item, w), 0)
def _get_one_learning_ull(self): user = UserFactory.create() user.profile.rrhh_code = 'example_code' user.profile.documento = 'example_codeL' pdf = CVN.get_user_pdf_ull(user=user) cvn = CVN(user=user, pdf=pdf) cvn.xml_file.open() cvn_items = etree.parse(cvn.xml_file).findall('CvnItem') self.assertEqual(len(cvn_items), 1) item = parse_cvnitem(cvn_items[0]) ws_content = CachedWS.get(st.WS_ULL_LEARNING % 'example_code') self.assertEqual(len(ws_content), 1) wi = ws_content[0] CVN._clean_data_learning(wi) if u'des1_grado_titulacion' in wi: wi[u'des1_grado_titulacion'] = wi[u'des1_grado_titulacion'].upper() if wi[u'des1_grado_titulacion'] == u'DOCTOR': del wi[u'des1_grado_titulacion'] if not u'des1_organismo' in wi: wi[u'des1_organismo'] = u'Universidad de La Laguna' self.assertEqual(cmp(item, wi), 0)