Ejemplo n.º 1
0
def test_get_all_groups(group_1: Group, group_2: Group):
    # test with no group in es
    groups_1: List[Group] = Group.get_all_groups()
    assert len(groups_1) == 0

    # init groups
    group_1.save()
    group_2.save()
    sleep(1)

    # test with 2 group in es
    groups_2: List[Group] = Group.get_all_groups()
    assert len(groups_2) == 2
    assert isinstance(groups_2[0], Group)
Ejemplo n.º 2
0
def test_migrate_models_command(app: Flask):
    runner: FlaskCliRunner = app.test_cli_runner()

    # delete index
    delte_index()

    # check if index was deleted
    with pytest.raises(NotFoundError):
        Group.get_all_groups()
    with pytest.raises(NotFoundError):
        MeetupZip.get_all_zips()

    # migrate models
    result_1: Result = runner.invoke(migrate_models_command)
    assert result_1.exit_code == 0
    sleep(2)

    # check if indexes was created
    assert isinstance(Group.get_all_groups(), List)
    assert isinstance(MeetupZip.get_all_zips(), List)
Ejemplo n.º 3
0
def update_groups():
    """
    update for all groups new events
    """
    # get all groups
    groups: List[Group] = Group.get_all_groups()

    # init api client
    api_client: MeetupApiClient = MeetupApiClient()

    # update all groups
    for group in groups:
        api_client.update_all_group_events(group=group)