mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat(docker): Add pytest support to docker-compose-light.yml (#34373)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
6f5d9c989a
commit
246181a546
@@ -552,13 +552,30 @@ def test_raise_for_access_chart_owner(
|
||||
engine = session.get_bind()
|
||||
Slice.metadata.create_all(engine) # pylint: disable=no-member
|
||||
|
||||
alpha = User(
|
||||
first_name="Alice",
|
||||
last_name="Doe",
|
||||
email="adoe@example.org",
|
||||
username="admin",
|
||||
roles=[Role(name="Alpha")],
|
||||
)
|
||||
# Check if Alpha role already exists
|
||||
alpha_role = session.query(Role).filter_by(name="Alpha").first()
|
||||
if not alpha_role:
|
||||
alpha_role = Role(name="Alpha")
|
||||
session.add(alpha_role)
|
||||
session.commit()
|
||||
|
||||
# Check if user already exists
|
||||
alpha = session.query(User).filter_by(username="test_chart_owner_user").first()
|
||||
if not alpha:
|
||||
alpha = User(
|
||||
first_name="Alice",
|
||||
last_name="Doe",
|
||||
email="adoe@example.org",
|
||||
username="test_chart_owner_user",
|
||||
roles=[alpha_role],
|
||||
)
|
||||
session.add(alpha)
|
||||
session.commit()
|
||||
else:
|
||||
# Ensure the user has the Alpha role
|
||||
if alpha_role not in alpha.roles:
|
||||
alpha.roles.append(alpha_role)
|
||||
session.commit()
|
||||
|
||||
slice = Slice(
|
||||
id=1,
|
||||
|
||||
Reference in New Issue
Block a user