()
| 63 | |
| 64 | |
| 65 | def seed_data() -> None: |
| 66 | # create user and organisation for e2e test by front end |
| 67 | organisation: Organisation = Organisation.objects.create(name="Bullet Train Ltd") |
| 68 | org_admin: FFAdminUser = FFAdminUser.objects.create_user( # type: ignore[no-untyped-call] |
| 69 | email=settings.E2E_USER, |
| 70 | password=PASSWORD, |
| 71 | username=settings.E2E_USER, |
| 72 | ) |
| 73 | org_admin.add_organisation(organisation, OrganisationRole.ADMIN) |
| 74 | non_admin_user_with_org_permissions: FFAdminUser = FFAdminUser.objects.create_user( # type: ignore[no-untyped-call] # noqa: E501 |
| 75 | email=settings.E2E_NON_ADMIN_USER_WITH_ORG_PERMISSIONS, |
| 76 | password=PASSWORD, |
| 77 | ) |
| 78 | non_admin_user_with_project_permissions: FFAdminUser = ( |
| 79 | FFAdminUser.objects.create_user( # type: ignore[no-untyped-call] |
| 80 | email=settings.E2E_NON_ADMIN_USER_WITH_PROJECT_PERMISSIONS, |
| 81 | password=PASSWORD, |
| 82 | ) |
| 83 | ) |
| 84 | non_admin_user_with_env_permissions: FFAdminUser = FFAdminUser.objects.create_user( # type: ignore[no-untyped-call] # noqa: E501 |
| 85 | email=settings.E2E_NON_ADMIN_USER_WITH_ENV_PERMISSIONS, |
| 86 | password=PASSWORD, |
| 87 | ) |
| 88 | non_admin_user_with_a_role: FFAdminUser = FFAdminUser.objects.create_user( # type: ignore[no-untyped-call] |
| 89 | email=settings.E2E_NON_ADMIN_USER_WITH_A_ROLE, |
| 90 | password=PASSWORD, |
| 91 | ) |
| 92 | non_admin_user_with_org_permissions.add_organisation(organisation) |
| 93 | non_admin_user_with_project_permissions.add_organisation(organisation) |
| 94 | non_admin_user_with_env_permissions.add_organisation(organisation) |
| 95 | non_admin_user_with_a_role.add_organisation(organisation) |
| 96 | |
| 97 | # Add permissions to the non-admin user with org permissions |
| 98 | user_org_permission = UserOrganisationPermission.objects.create( |
| 99 | user=non_admin_user_with_org_permissions, organisation=organisation |
| 100 | ) |
| 101 | user_org_permission.add_permission(CREATE_PROJECT) |
| 102 | user_org_permission.add_permission(MANAGE_USER_GROUPS) |
| 103 | UserPermissionGroup.objects.create(name="TestGroup", organisation=organisation) |
| 104 | |
| 105 | separate_org: Organisation = Organisation.objects.create(name="E2E Separate Org") |
| 106 | separate_test_user: FFAdminUser = FFAdminUser.objects.create_user( # type: ignore[no-untyped-call] |
| 107 | email=settings.E2E_SEPARATE_TEST_USER, |
| 108 | password=PASSWORD, |
| 109 | ) |
| 110 | separate_test_user.add_organisation(separate_org, OrganisationRole.ADMIN) |
| 111 | |
| 112 | # Billing-tab tests need an organisation on a Free plan (no |
| 113 | # `subscription_id`) so PaymentButton renders the Chargebee DOM-scan |
| 114 | # branch. The default Subscription created by Organisation's AFTER_CREATE |
| 115 | # hook already matches — leave it untouched. |
| 116 | billing_org: Organisation = Organisation.objects.create(name="E2E Billing Org") |
| 117 | billing_user: FFAdminUser = FFAdminUser.objects.create_user( # type: ignore[no-untyped-call] |
| 118 | email=settings.E2E_BILLING_USER, |
| 119 | password=PASSWORD, |
| 120 | ) |
| 121 | billing_user.add_organisation(billing_org, OrganisationRole.ADMIN) |
| 122 |
no test coverage detected