Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RHCLOUD-36014] Test: No replication call for group without principals #1302

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions tests/migration_tool/tests_migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
from uuid import uuid4

from django.test import TestCase, override_settings

from django.utils import timezone

from api.models import CrossAccountRequest, Tenant

from management.models import *
from management.role.definer import seed_roles

from management.tenant_service.tenant_service import BootstrappedTenant
from management.tenant_service.v2 import V2TenantBootstrapService
from migration_tool.in_memory_tuples import (
Expand All @@ -43,7 +44,9 @@
subject,
subject_type,
)
from migration_tool.migrate import migrate_data

from migration_tool.migrate import migrate_data, migrate_groups_for_tenant

from management.group.definer import seed_group, clone_default_group_in_public_schema
from tests.management.role.test_dual_write import RbacFixture

Expand Down Expand Up @@ -161,6 +164,14 @@ def setUp(self):
)
self.cross_account_request.roles.add(self.system_role_2)

@override_settings(REPLICATION_TO_RELATION_ENABLED=True, PRINCIPAL_USER_DOMAIN="redhat", READ_ONLY_API_MODE=True)
@patch("migration_tool.migrate.RelationApiDualWriteGroupHandler.replicate")
def test_migration_of_data_no_replication_event_to_migrate_groups(self, replicate_method):
"""Test that we get the correct access for a principal."""
kwargs = {"exclude_apps": ["app1"], "orgs": ["7654321"]}
migrate_data(**kwargs)
replicate_method.assert_not_called()

@override_settings(REPLICATION_TO_RELATION_ENABLED=True, PRINCIPAL_USER_DOMAIN="redhat", READ_ONLY_API_MODE=True)
@patch("management.relation_replicator.logging_replicator.logger")
def test_migration_of_data(self, logger_mock):
Expand Down