def test_delete_producciones(self): user = UserFactory.create() cvn = CVN(user=user, pdf_path=get_cvn_path('CVN-Test')) cvn.insert_xml() cvn.remove_producciones() self.assertEqual(user.profile.articulo_set.count(), 0) self.assertEqual(user.profile.capitulo_set.count(), 0) self.assertEqual(user.profile.congreso_set.count(), 0) self.assertEqual(user.profile.convenio_set.count(), 0) self.assertEqual(user.profile.libro_set.count(), 0) self.assertEqual(user.profile.proyecto_set.count(), 0) self.assertEqual(user.profile.tesisdoctoral_set.count(), 0)
def test_insert_xml_ull(self): """ Insert the data of XML in the database """ user = UserFactory.create() cvn = CVN(user=user, pdf_path=get_cvn_path('CVN-ULL')) cvn.insert_xml() self.assertEqual(user.profile.articulo_set.count(), 1214) self.assertEqual(user.profile.libro_set.count(), 6) self.assertEqual(user.profile.capitulo_set.count(), 32) self.assertEqual(user.profile.congreso_set.count(), 55) self.assertEqual(user.profile.convenio_set.count(), 38) self.assertEqual(user.profile.proyecto_set.count(), 11) self.assertEqual(user.profile.tesisdoctoral_set.count(), 0)
def test_user_rrhh(self): driver = self.driver driver.get(self.base_url + "login?service=http%3A%2F%2Flocalhost%3A8081%2F" + "investigacion%2Faccounts%2Flogin%2F%3Fnext%3D%252F" + "es%252Finvestigacion%252Fcvn%252F") driver.find_element_by_id("username").clear() driver.find_element_by_id("username").send_keys("invbecario") driver.find_element_by_id("password").clear() driver.find_element_by_id("password").send_keys("pruebasINV1") driver.find_element_by_name("submit").click() driver.execute_script( 'document.getElementById("id_cvn_file").removeAttribute("style")') driver.find_element_by_id("id_cvn_file").send_keys( get_cvn_path('CVN-Test_2')) self.assertFalse(self.is_element_present(By.ID, "dept")) driver.find_element_by_link_text(u"Cerrar sesión").click()
def test_insert_patentes(self): u = UserFactory.create() cvn = CVN(user=u, pdf_path=get_cvn_path('cvn-patentes')) cvn.insert_xml() patente = Patente.objects.get(num_solicitud=111111111111111) self.assertEqual(patente.titulo, "Patente uno") self.assertEqual(patente.fecha, datetime.date(2011, 01, 01)) self.assertEqual(patente.fecha_concesion, datetime.date(2011, 01, 02)) self.assertEqual(patente.lugar_prioritario, u'Canarias, Spain') self.assertEqual(patente.lugares, u'Israel; Andalucía, Spain') self.assertEqual(patente.autores, u'Judas Iscariote (JI); Juan Rodríguez González') self.assertEqual(patente.entidad_titular, u'BANCO POPULAR ESPAÑOL, S.A.') self.assertEqual(patente.empresas, u'Banco Pastor; CEMUSA CORPORACION EUROPEA DE ' 'MOBILIARIO URBANO SA')
def test_upload_cvn_fecyt(self): driver = self.driver driver.get(self.base_url + "login?service=http%3A%2F%2Flocalhost%3A8081%2F" + "investigacion%2Faccounts%2Flogin%2F%3Fnext%3D%252F" + "es%252Finvestigacion%252Fcvn%252F") driver.find_element_by_id("username").clear() driver.find_element_by_id("username").send_keys("invbecario") driver.find_element_by_id("password").clear() driver.find_element_by_id("password").send_keys("pruebasINV1") driver.find_element_by_name("submit").click() # driver.find_element_by_id("id_cvn_file").clear() driver.execute_script( 'document.getElementById("id_cvn_file").removeAttribute("style")') driver.find_element_by_id("id_cvn_file").send_keys( get_cvn_path('CVN-Test_2')) #driver.find_element_by_xpath("//button[@type='submit']").click() self.assertTrue(self.is_element_present(By.CLASS_NAME, "alert-success")) driver.find_element_by_link_text(u"Cerrar sesión").click()
def test_productions_no_title(self): u = UserFactory.create() cvn = CVN(user=u, pdf_path=get_cvn_path('produccion_sin_titulo')) cvn.insert_xml() self.assertEqual(len(u.profile.proyecto_set.all()), 3) self.assertEqual(len(Articulo.objects.filter(user_profile__user=u)), 3)
def test_update_from_pdf(self): us = UserFactory.create() cvn = CVN(user=us) pdf_file = file(get_cvn_path('CVN-Test')) cvn.update_from_pdf(pdf_file.read()) self.assertTrue(cvn.xml_file and cvn.cvn_file)
def test_valid_identity_nif_without_letter(self): user = UserFactory.create() user.profile.documento = '11111111H' user.profile.save() cvn = CVN(user=user, pdf_path=get_cvn_path('CVN-NIF-sin_letra')) self.assertNotEqual(cvn.status, st_cvn.CVNStatus.INVALID_IDENTITY)