示例#1
0
 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)
示例#2
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)