Exemplo n.º 1
0
    def run(self):
        faker = Faker(
            cls=VirtualAssistant,
            init={
                "id":
                generator.Sequence(),
                "name":
                generator.Name(),
                "last_name":
                generator.Name(),
                "job":
                generator.String(
                    "(1st pressman|1st Pressman On Web Press|2nd Grade Teacher|2nd pressman|3d animator)"
                ),
                "image_filename":
                generator.String("[0-9]{1,2}.jpg"),
                "image_url":
                generator.String(
                    "(https://fwcdn.pl/ppo/70/74/57074/449882.2.jpg|https://fwcdn.pl/ppo/01/09/109/449960.2.jpg|https://fwcdn.pl/ppo/03/16/316/449937.2.jpg|https://ssl-gfx.filmweb.pl/ph/06/99/640699/831926_1.2.jpg|https://ssl-gfx.filmweb.pl/ph/97/46/399746/245837_1.2.jpg)"
                ),
            })

        #Create 5 virtul assistants
        for assistant in faker.create(5):
            print("Adding VirtualAssistant: %s" % assistant)
            self.db.session.add(assistant)
Exemplo n.º 2
0
    def run(self):
        _id = generator.Sequence()

        faker_for_state = Faker(cls=State,
                                init={
                                    'id': _id,
                                    'name': StateGeneratorSequence(),
                                    'lat': "99.000",
                                    'lng': "99.000",
                                })

        faker_for_total = Faker(cls=State,
                                init={
                                    'id': _id,
                                    'name': 'Total',
                                    'lat': f"00.000",
                                    'lng': f"00.000",
                                })

        for state in faker_for_total.create(1):
            print("Adding state: %s" % state)
            self.db.session.add(state)

        for state in faker_for_state.create(27):
            print("Adding state: %s" % state)
            self.db.session.add(state)
Exemplo n.º 3
0
    def run(self):
        _id = generator.Sequence()
        __id = generator.Sequence()

        faker_for_state = Faker(
            cls=StateCases,
            init={
                'id': _id,
                'country': 'Brazil',
                'state_id': __id,
                'totalcases': generator.Integer(start=10, end=20),
                'totalcasesms': generator.Integer(start=1, end=10),
                'notconfirmedbyms': generator.Integer(start=1, end=10),
                'deaths': generator.Integer(start=0, end=2),
                'url': 'https://someurl.com.br'

            }
        )

        faker_for_total = Faker(
            cls=StateCases,
            init={
                'id': _id,
                'country': 'Brazil',
                'state_id': __id,
                'totalcases': 100,
                'totalcasesms': 50,
                'notconfirmedbyms': 50,
                'deaths': 10,
                'url': 'https://someurl.com.br'

            }
        )

        for state in faker_for_total.create(1):
            print("Adding state case: %s" % state)
            self.db.session.add(state)

        for state in faker_for_state.create(27):
            print("Adding state case: %s" % state)
            self.db.session.add(state)
Exemplo n.º 4
0
    def run(self):
        # Create a new Faker and tell it how to create User objects
        faker = Faker(cls=User,
                      init={
                          "id_num": generator.Sequence(),
                          "name": generator.Name(),
                          "age": generator.Integer(start=20, end=100)
                      })

        # Create 5 users
        for user in faker.create(5):
            print("Adding user: %s" % user)
            self.db.session.add(user)
Exemplo n.º 5
0
    def run(self):
        # Create a new Faker and tell it how to create User objects
        faker = Faker(cls=User,
                      init={
                          "id": generator.Sequence(),
                          "name": generator.Name(),
                          "email": "*****@*****.**",
                          "password": hashlib.md5("secret"),
                          "role": "admin"
                      })

        for user in faker.create(1):
            print("Adding user: %s" % user)
            self.db.session.add(user)
Exemplo n.º 6
0
    def run(self):
        faker = Faker(cls=Actions,
                      init={
                          "id":
                          generator.Sequence(),
                          "action_name":
                          CustomFromListGenerator(
                              ["Updated post", "Updated article"]),
                      })

        for record in faker.create(2):
            print("Adding:", record)
            self.db.session.add(record)
        self.db.session.commit()
Exemplo n.º 7
0
    def run(self):
        faker = Faker(cls=Assistant,
                      init={
                          "id": generator.Sequence(),
                          "name": generator.Name(),
                          "surname": generator.Name(),
                          "job": Job(),
                          "photo_name": Photo()
                      })

        # Create 10 users
        for elem in faker.create(10):
            print("Adding assistant: %s" % elem)
            self.db.session.add(elem)
Exemplo n.º 8
0
    def run(self):
        faker = Faker(
            cls=User,
            init={
                "name": generator.Name(),
                "email": "*****@*****.**",
                "password": "******",
                "description": generator.Sequence(),
                "role": ERole.ADMIN,
            },
        )

        for user in faker.create():
            print("Adding user: %s" % user)
            self.db.session.add(user)
Exemplo n.º 9
0
    def run(self):

        # Create a new Faker and tell it how to create User objects
        faker = Faker(cls=User,
                      init={
                          "id":
                          generator.Sequence(),
                          "email":
                          "*****@*****.**",
                          "password_hash":
                          generate_password_hash(Config.ADMIN_PASSWORD)
                      })

        payload = faker.create()
        print(payload)
        self.db.session.add(payload[0])
Exemplo n.º 10
0
    def run(self):
        today = date.today()
        faker = Faker(cls=Assistant,
                      init={
                          "id": generator.Sequence(),
                          "firstname": generator.Name(),
                          "lastname": generator.Name(),
                          "email": generator.String(),
                          "occupation": generator.String(),
                          "creationdate": today,
                          "filename": "default.png"
                      })

        for assistant in faker.create(5):
            print("Adding assistant: %s" % Assistant)
            self.db.session.add(assistant)
Exemplo n.º 11
0
    def run(self):
        faker = Faker(cls=Article_categories,
                      init={
                          "category_id":
                          generator.Sequence(),
                          "category_name":
                          CustomFromListGenerator([
                              "games", "music", "travel", "sport",
                              "documentary", "captured", "technology",
                              "fashion", "movies"
                          ]),
                      })

        for record in faker.create(9):
            print("Adding:", record)
            self.db.session.add(record)
        self.db.session.commit()
Exemplo n.º 12
0
    def run(self):
        _id = generator.Sequence()

        faker_for_state = Faker(cls=StateCasesPerDay,
                                init={
                                    'id':
                                    _id,
                                    'date':
                                    DateGenerator('-15d', 'now'),
                                    'country':
                                    'Brazil',
                                    'state_id':
                                    StateGeneratorRandom(),
                                    'newcases':
                                    generator.Integer(start=0, end=12),
                                    'totalcases':
                                    generator.Integer(start=10, end=20)
                                })

        faker_for_total = Faker(cls=StateCasesPerDay,
                                init={
                                    'id':
                                    _id,
                                    'date':
                                    DateGenerator('-15d', 'now'),
                                    'country':
                                    'Brazil',
                                    'state_id':
                                    'TOTAL',
                                    'newcases':
                                    generator.Integer(start=0, end=12),
                                    'totalcases':
                                    generator.Integer(start=10, end=20)
                                })

        for state in faker_for_state.create(10):
            print("Adding state per day: %s" % state)
            self.db.session.add(state)

        for state in faker_for_total.create(10):
            print("Adding state per day: %s" % state)
            self.db.session.add(state)
Exemplo n.º 13
0
    def run(self):

        faker_for_city = Faker(cls=City,
                               init={
                                   'id':
                                   generator.Sequence(start=1, end=1000),
                                   'ibge_id':
                                   generator.Integer(start=300000, end=399999),
                                   'country':
                                   'Brazil',
                                   'city':
                                   'Test',
                                   'deaths':
                                   1,
                                   'state_id':
                                   generator.Integer(start=2, end=28),
                                   'totalcases':
                                   generator.Integer(start=1, end=10)
                               })

        for case in faker_for_city.create(500):
            print("Adding city case: %s" % case)
            self.db.session.add(case)