test_populate.py 529 B

123456789101112131415161718
  1. from flaskbb.utils.populate import create_default_groups, GROUPS
  2. from flaskbb.user.models import Group
  3. def test_create_default_groups(database):
  4. """Test that the default groups are created correctly."""
  5. assert Group.query.count() == 0
  6. create_default_groups()
  7. assert Group.query.count() == len(GROUPS)
  8. for key, attributes in GROUPS.items():
  9. group = Group.query.filter_by(name=key).first()
  10. for attribute, value in attributes.items():
  11. assert getattr(group, attribute) == value