Ejemplo n.º 1
0
    def setUp(self):
        self.maxDiff = None
        self.c = Client()

        this_folder = os.path.abspath(os.path.dirname(__file__))
        dummy_db_json = os.path.join(this_folder, '..', '..', 'pdl', 'tests',
                                     'dummy_db.json')
        dummy_items = json.loads(open(dummy_db_json, 'r').read())

        for i in dummy_items:
            b = Proyecto(**i)
            b.save()
            s = Seguimientos(
                proyecto=b,
                fecha='2014-06-23',
                evento='Decreado a... Ciencia, Innovación y Tecnología')
            s.save()
            s1 = Seguimientos(
                proyecto=b,
                fecha='2015-06-23',
                evento='En comisión de Ciencia, Innovación y Tecnología')
            s1.save()

        Slug(nombre='Chihuan Ramos, Leyla Felicita',
             ascii='Chihuan Ramos, Leyla Felicita',
             slug='chihuan-ramos-leyla-felicita').save()
Ejemplo n.º 2
0
    def setUp(self):
        self.maxDiff = None

        this_folder = os.path.abspath(os.path.dirname(__file__))
        dummy_db_json = os.path.join(this_folder, 'dummy_db.json')
        self.dummy_items = json.loads(open(dummy_db_json, 'r').read())

        dummy_slugs = os.path.join(this_folder, 'dummy_slugs.json')
        dummy_slugs = json.loads(open(dummy_slugs, 'r').read())
        for i in dummy_slugs:
            b = Slug(**i)
            b.save()

        Dispensed.objects.create(**{
            'total_approved': 1444,
            'total_dispensed': 864,
            'dispensed_by_plenary': 23,
            'dispensed_by_spokesmen': 12,
            'dispensed_others': 11,
        })
Ejemplo n.º 3
0
    def setUp(self):
        self.maxDiff = None

        this_folder = os.path.abspath(os.path.dirname(__file__))
        dummy_db_json = os.path.join(this_folder, 'dummy_db.json')
        self.dummy_items = json.loads(open(dummy_db_json, 'r').read())

        dummy_slugs = os.path.join(this_folder, 'dummy_slugs.json')
        dummy_slugs = json.loads(open(dummy_slugs, 'r').read())
        for i in dummy_slugs:
            b = Slug(**i)
            b.save()

        Dispensed.objects.create(
            **{
                'total_approved': 1444,
                'total_dispensed': 864,
                'dispensed_by_plenary': 23,
                'dispensed_by_spokesmen': 12,
                'dispensed_others': 11,
            })
Ejemplo n.º 4
0
 def handle(self, *args, **options):
     all_current_slugs = [
         i["slug"]
         for i in Slug.objects.all().values("slug")
     ]
     person_names_bundled = Proyecto.objects.all().values("congresistas")
     all_names = []
     for item in person_names_bundled:
         names = item["congresistas"].split(";")
         all_names += [i.strip() for i in names]
     for name in set(all_names):
         ascii_name = convert_to_ascii(name)
         slug = slugify(name)
         if slug not in all_current_slugs:
             s = Slug(
                 ascii=ascii_name,
                 nombre=name,
                 slug=slug,
             )
             s.save()
             print("Created slug for {!r}".format(name))
Ejemplo n.º 5
0
    def test_proyect_items(self):
        this_folder = os.path.abspath(os.path.dirname(__file__))
        dummy_db_json = os.path.join(this_folder, 'dummy_db.json')
        dummy_items = json.loads(open(dummy_db_json, 'r').read())
        b = Proyecto(**dummy_items[0])
        b.save()

        c = Client()
        response = c.get('/sitemap.xml')
        soup = BeautifulSoup(response.content)
        self.assertEqual(1, len(soup.find_all('url')))

        nombre = 'Zerillo Bazalar, Manuel Salvador'
        slug = 'zerillo_bazalar_manuel/'
        b = Slug(nombre=nombre, slug=slug)
        b.save()
        response = c.get('/sitemap.xml')
        self.assertTrue(slug.encode('utf-8') in response.content)
Ejemplo n.º 6
0
    def setUp(self):
        self.maxDiff = None
        dummy = {
            "codigo":
            "03774",
            'legislatura':
            2016,
            "congresistas":
            "Dammert Ego Aguirre, Manuel Enrique Ernesto; Lescano Ancieta, Yonhy; Merino De Lama, Manuel; Guevara Amasifuen, Mesias Antonio; Mavila Leon, Rosa Delsa; Mendoza Frisch, Veronika Fanny",
            "expediente":
            "http://www2.congreso.gob.pe/sicr/tradocestproc/Expvirt_2011.nsf/visbusqptramdoc/03774?opendocument",
            "fecha_presentacion":
            "2014-09-05",
            "id":
            3763,
            "numero_proyecto":
            "03774/2014-CR",
            "pdf_url":
            "http://www2.congreso.gob.pe/Sicr/TraDocEstProc/Contdoc02_2011_2.nsf/d99575da99ebfbe305256f2e006d1cf0/dbc9030966aac60905257d4a007b75d9/$FILE/PL03774050914.pdf",
            "seguimiento_page":
            "http://www2.congreso.gob.pe/Sicr/TraDocEstProc/CLProLey2011.nsf/Sicr/TraDocEstProc/CLProLey2011.nsf/PAporNumeroInverso/9609130B9871582F05257D4A00752301?opendocument",
            "short_url":
            "4aw8ym",
            "nombre_comision":
            "economia",
            "time_created":
            "2014-09-05 03:00:00",
            "time_edited":
            "2014-09-05 03:00:00",
            "titulo":
            "Propone establecer los lineamientos para la promoción de la eficiencia y competitividad en la actividad empresarial del Estado, garantizando su aporte estratégico para el desarrollo descentralizado y la soberanía nacional."
        }
        self.p = Proyecto(**dummy)
        self.p.save()

        dummy_slug = {
            "nombre": "Dammert Ego Aguirre, Manuel Enrique Ernesto",
            "ascii": "Dammert Ego Aguirre, Manuel Enrique Ernesto",
            "slug": "dammert_ego_aguirre/",
        }
        Slug(**dummy_slug).save()

        self.c = Client()