<s> import pytest <EOL> from flaskbb . utils . populate import * <EOL> from flaskbb . fixtures . groups import fixture as group_fixture <EOL> from flaskbb . fixtures . settings import fixture as settings_fixture <EOL> from flaskbb . user . models import Group <EOL> from flaskbb . forum . models import Category , Topic , Post <EOL> def test_delete_settings_from_fixture ( default_settings ) : <EOL> groups_count = SettingsGroup . query . count ( ) <EOL> assert len ( settings_fixture ) == groups_count <EOL> deleted = delete_settings_from_fixture ( settings_fixture ) <EOL> assert len ( settings_fixture ) == len ( deleted ) <EOL> assert not SettingsGroup . query . count ( ) <EOL> assert not Setting . query . count ( ) <EOL> def test_create_settings_from_fixture ( database ) : <EOL> assert not SettingsGroup . query . count ( ) <EOL> assert not Setting . query . count ( ) <EOL> created = create_settings_from_fixture ( settings_fixture ) <EOL> assert len ( settings_fixture ) == len ( created ) <EOL> assert SettingsGroup . query . count ( ) == len ( created ) <EOL> def test_update_settings_from_fixture ( database ) : <EOL> assert not SettingsGroup . query . count ( ) <EOL> assert not Setting . query . count ( ) <EOL> updated = update_settings_from_fixture ( settings_fixture ) <EOL> assert len ( updated ) == SettingsGroup . query . count ( ) <EOL> force_updated = update_settings_from_fixture ( settings_fixture , <EOL> overwrite_group = True , <EOL> overwrite_setting = True ) <EOL> assert len ( force_updated ) == SettingsGroup . query . count ( ) <EOL> def test_create_admin_user ( default_groups ) : <EOL> user = User . query . filter_by ( username = "<STR_LIT>" ) . first ( ) <EOL> assert not user <EOL> user = create_admin_user ( username = "<STR_LIT>" , password = "<STR_LIT:test>" , <EOL> email = "<STR_LIT>" ) <EOL> assert user . username == "<STR_LIT>" <EOL> assert user . permissions [ "<STR_LIT>" ] <EOL> def test_create_welcome_forum ( default_groups ) : <EOL> assert not create_welcome_forum ( ) <EOL> create_admin_user ( username = "<STR_LIT>" , password = "<STR_LIT:test>" , <EOL> email = "<STR_LIT>" ) <EOL> assert create_welcome_forum ( ) <EOL> def test_create_test_data ( database ) : <EOL> assert Category . query . count ( ) == <NUM_LIT:0> <EOL> data_created = create_test_data ( ) <EOL> assert Category . query . count ( ) == data_created [ '<STR_LIT>' ] <EOL> def test_insert_mass_data ( database ) : <EOL> assert not insert_mass_data ( topics = <NUM_LIT:1> , posts = <NUM_LIT:1> ) <EOL> create_test_data ( categories = <NUM_LIT:1> , forums = <NUM_LIT:1> , topics = <NUM_LIT:0> ) <EOL> assert Topic . query . count ( ) == <NUM_LIT:0> <EOL> topics , posts = insert_mass_data ( topics = <NUM_LIT:1> , posts = <NUM_LIT:1> ) <EOL> assert Topic . query . count ( ) == topics <EOL> assert Post . query . count ( ) - <NUM_LIT:1> == posts <EOL> def test_create_default_groups ( database ) : <EOL> """<STR_LIT>""" <EOL> assert Group . query . count ( ) == <NUM_LIT:0> <EOL> create_default_groups ( ) <EOL> assert Group . query . count ( ) == len ( group_fixture ) <EOL> for key , attributes in group_fixture . items ( ) : <EOL> group = Group . query . filter_by ( name = key ) . first ( ) <EOL> for attribute , value in attributes . items ( ) : <EOL> assert getattr ( group , attribute ) == value </s>
