Exemple #1
0
    def test_get_actions(self, client):
        ActionFactory.create_batch(size=3)

        url = app.url_path_for('get_actions')
        response = client.get(url)

        assert response.status_code == HTTPStatus.OK

        assert response.json()['data']
Exemple #2
0
def generate() -> None:
    """
    Generates some initial records in database
    """
    from tests.factories import UserFactory, ActionFactory, MessageFactory, CostFactory
    db.connect()
    db.create_tables([db_models.User, db_models.Cost, db_models.Action, db_models.Photo, db_models.Message])

    # will generate the whole database by chain of subfactories
    UserFactory.create_batch(size=5)
    ActionFactory.create_batch(size=5)
    MessageFactory.create_batch(size=5)
    CostFactory.create_batch(size=5)
    click.secho("\nGeneration done!", fg='green')
    db.close()