@pytest.mark.cmd
@pytest.mark.django_db
def test_cmd_initdb(capfd, po_directory, no_permission_sets, no_permissions, no_users, no_projects, templates):
 templates.delete()
 call_command('initdb')
 (out, err) = capfd.readouterr()
 assert ('Successfully populated the database.' in out)
 assert ('pootle createsuperuser' in out)
 assert (sorted(Project.objects.values_list('code', flat=True)) == ['terminology', 'tutorial'])
 po = Format.objects.get(name='po')
 assert (po in Project.objects.get(code='terminology').filetypes.all())
 assert (po in Project.objects.get(code='tutorial').filetypes.all())

@ pytest . mark . cmd @ pytest . mark . django_db def test_cmd_initdb ( capfd , po_directory , no_permission_sets , no_permissions , no_users , no_projects , templates ) : templates . delete ( ) call_command ( 'initdb' ) ( out , err ) = capfd . readouterr ( ) assert ( 'Successfully populated the database.' in out ) assert ( 'pootle createsuperuser' in out ) assert ( sorted ( Project . objects . values_list ( 'code' , flat = True ) ) == [ 'terminology' , 'tutorial' ] ) po = Format . objects . get ( name = 'po' ) assert ( po in Project . objects . get ( code = 'terminology' ) . filetypes . all ( ) ) assert ( po in Project . objects . get ( code = 'tutorial' ) . filetypes . all ( ) )
initialise the database with initdb .