Beispiel #1
0
    def test_positive_synchronize_custom_product_daily_recurrence(self):
        """Create a daily sync plan with current datetime as a sync date,
        add a custom product and verify the product gets synchronized on
        the next sync occurrence

        :id: d60e33a0-f75c-498e-9e6f-0a2025295a9d

        :expectedresults: Product is synchronized successfully.

        :CaseLevel: System
        """
        delay = 4 * 60
        start_date = datetime.utcnow() - timedelta(days=1)\
            + timedelta(seconds=delay)
        product = entities.Product(organization=self.org).create()
        repo = entities.Repository(product=product).create()
        # Create and Associate sync plan with product
        sync_plan = entities.SyncPlan(
            organization=self.org,
            enabled=True,
            interval=u'daily',
            sync_date=start_date,
        ).create()
        sync_plan.add_products(data={'product_ids': [product.id]})
        # Verify product is not synced and doesn't have any content
        self.logger.info('Waiting {0} seconds to check product {1}'
                         ' was not synced'.format(delay/4, product.name))
        sleep(delay/4)
        with self.assertRaises(AssertionError):
            self.validate_task_status(repo.id, max_tries=2)
        self.validate_repo_content(
            repo, ['erratum', 'package', 'package_group'], after_sync=False)
        # Wait the rest of expected time
        self.logger.info('Waiting {0} seconds to check product {1}'
                         ' was synced'.format(delay, product.name))
        sleep(delay * 3/4)
        # Re-calculate and Update with the current UTC time
        start_date = datetime.utcnow() - timedelta(days=1)\
            + timedelta(seconds=delay)
        sync_plan.sync_date = start_date
        sync_plan.update(['sync_date'])
        # Verify product was synced successfully
        self.validate_task_status(repo.id,
                                  repo_backend_id=repo.backend_identifier
                                  )
        self.validate_repo_content(
            repo, ['erratum', 'package', 'package_group'])
Beispiel #2
0
    def test_positive_create_with_interval(self):
        """Create a sync plan with a random interval.

        :id: d160ed1c-b698-42dc-be0b-67ac693c7840

        :expectedresults: A sync plan is created with the specified interval.

        :CaseImportance: Critical
        """
        for interval in valid_sync_interval():
            sync_plan = entities.SyncPlan(
                description=gen_string('alpha'), organization=self.org, interval=interval
            )
            if interval == SYNC_INTERVAL['custom']:
                sync_plan.cron_expression = gen_choice((valid_cron_expressions()))
            sync_plan = sync_plan.create()
            self.assertEqual(sync_plan.interval, interval)
def test_positive_update_description(module_org, description):
    """Create a sync plan and update its description.

    :id: 4769fe9c-9eec-40c8-b015-1e3d7e570bec

    :parametrized: yes

    :expectedresults: A sync plan is created and its description can be
        updated with the specified description.
    """
    sync_plan = entities.SyncPlan(
        description=gen_string('alpha'), organization=module_org
    ).create()
    sync_plan.description = description
    sync_plan.update(['description'])
    sync_plan = sync_plan.read()
    assert sync_plan.description == description
Beispiel #4
0
    def test_negative_create_with_invalid_name(self):
        """Create a sync plan with an invalid name.

        :id: a3a0f844-2f81-4f87-9f68-c25506c29ce2

        :expectedresults: A sync plan can not be created with the specified
            name.

        :CaseImportance: Critical
        """
        for name in invalid_values_list():
            with self.subTest(name):
                with self.assertRaises(HTTPError):
                    entities.SyncPlan(
                        name=name,
                        organization=self.org
                    ).create()
Beispiel #5
0
    def test_positive_repeatedly_add_remove(self):
        """Repeatedly add and remove a product from a sync plan.

        @id: b67536ba-3a36-4bb7-a405-0e12081d5a7e

        @Assert: A task is returned which can be used to monitor the additions
        and removals.

        @CaseLevel: Integration
        """
        syncplan = entities.SyncPlan(organization=self.org).create()
        product = entities.Product(organization=self.org).create()
        for _ in range(5):
            syncplan.add_products(data={'product_ids': [product.id]})
            self.assertEqual(len(syncplan.read().product), 1)
            syncplan.remove_products(data={'product_ids': [product.id]})
            self.assertEqual(len(syncplan.read().product), 0)
Beispiel #6
0
    def test_positive_remove_products(self):
        """Create a sync plan with two products and then remove both
        products from it.

        :id: eed8c239-8ba3-4dbd-aa6b-c289cd4efd47

        :expectedresults: A sync plan can be created and both products can be
            removed from it.

        :CaseLevel: Integration
        """
        syncplan = entities.SyncPlan(organization=self.org).create()
        products = [entities.Product(organization=self.org).create() for _ in range(2)]
        syncplan.add_products(data={'product_ids': [product.id for product in products]})
        self.assertEqual(len(syncplan.read().product), 2)
        syncplan.remove_products(data={'product_ids': [product.id for product in products]})
        self.assertEqual(len(syncplan.read().product), 0)
Beispiel #7
0
def test_positive_update_name(module_org, name):
    """Create a sync plan and update its name.

    :id: dbfadf4f-50af-4aa8-8d7d-43988dc4528f

    :parametrized: yes

    :expectedresults: A sync plan is created and its name can be updated
        with the specified name.

    :CaseImportance: Critical
    """
    sync_plan = entities.SyncPlan(organization=module_org).create()
    sync_plan.name = name
    sync_plan.update(['name'])
    sync_plan = sync_plan.read()
    assert sync_plan.name == name
Beispiel #8
0
    def test_positive_create_enabled_disabled(self):
        """Create sync plan with different 'enabled' field values.

        :id: df5837e7-3d0f-464a-bd67-86b423c16eb4

        :expectedresults: A sync plan is created, 'enabled' field has correct
            value.

        :CaseImportance: Critical
        """
        for enabled in (False, True):
            with self.subTest(enabled):
                sync_plan = entities.SyncPlan(
                    enabled=enabled,
                    organization=self.org,
                ).create()
                self.assertEqual(sync_plan.enabled, enabled)
    def test_positive_delete(self):
        """Delete an existing Sync plan

        @id: 81beec05-e38c-48bc-8f01-10cb1e10a3f6

        @Assert: Sync Plan is deleted successfully
        """
        with Session(self.browser) as session:
            for plan_name in generate_strings_list():
                with self.subTest(plan_name):
                    entities.SyncPlan(
                        name=plan_name,
                        interval=SYNC_INTERVAL['day'],
                        organization=self.organization,
                    ).create()
                    session.nav.go_to_select_org(self.organization.name)
                    self.syncplan.delete(plan_name)
def test_positive_synchronize_custom_product_future_sync_date(module_org):
    """Create a sync plan with sync date in a future and sync one custom
    product with it automatically.

    :id: b70a0c50-7335-4285-b24c-edfc1187f034

    :expectedresults: Product is synchronized successfully.

    :CaseLevel: System

    :BZ: 1655595, 1695733
    """
    delay = 2 * 60  # delay for sync date in seconds
    product = entities.Product(organization=module_org).create()
    repo = entities.Repository(product=product).create()
    # Verify product is not synced and doesn't have any content
    with pytest.raises(AssertionError):
        validate_task_status(repo.id, max_tries=1)
    validate_repo_content(repo, ['erratum', 'package', 'package_group'],
                          after_sync=False)
    # Create and Associate sync plan with product
    # BZ:1695733 is closed WONTFIX so apply this workaround
    logger.info('Need to set seconds to zero because BZ#1695733')
    sync_date = datetime.utcnow().replace(second=0) + timedelta(seconds=delay)
    sync_plan = entities.SyncPlan(organization=module_org,
                                  enabled=True,
                                  sync_date=sync_date).create()
    sync_plan.add_products(data={'product_ids': [product.id]})
    # Wait quarter of expected time
    logger.info(
        f'Waiting {delay / 4} seconds to check product {product.name} was not synced'
    )
    sleep(delay / 4)
    # Verify product has not been synced yet
    with pytest.raises(AssertionError):
        validate_task_status(repo.id, max_tries=1)
    validate_repo_content(repo, ['erratum', 'package', 'package_group'],
                          after_sync=False)
    # Wait the rest of expected time
    logger.info(
        f'Waiting {delay * 3 / 4} seconds to check product {product.name} was synced'
    )
    sleep(delay * 3 / 4)
    # Verify product was synced successfully
    validate_task_status(repo.id, repo_backend_id=repo.backend_identifier)
    validate_repo_content(repo, ['erratum', 'package', 'package_group'])
Beispiel #11
0
    def test_positive_create_with_sync_date(self):
        """Create a sync plan and update its sync date.

        :id: bdb6e0a9-0d3b-4811-83e2-2140b7bb62e3

        :expectedresults: A sync plan can be created with a random sync date.

        :CaseImportance: Critical
        """
        for syncdate in valid_sync_dates():
            with self.subTest(syncdate):
                sync_plan = entities.SyncPlan(
                    organization=self.org,
                    sync_date=syncdate,
                ).create()
                self.assertEqual(syncdate.strftime('%Y-%m-%d %H:%M:%S UTC'),
                                 sync_plan.sync_date)
Beispiel #12
0
    def test_positive_update_description(self):
        """Create a sync plan and update its description.

        @id: 4769fe9c-9eec-40c8-b015-1e3d7e570bec

        @Assert: A sync plan is created and its description can be updated with
        the specified description.
        """
        sync_plan = entities.SyncPlan(
            description=gen_string('alpha'),
            organization=self.org,
        ).create()
        for description in valid_data_list():
            with self.subTest(description):
                sync_plan.description = description
                self.assertEqual(
                    sync_plan.update(['description']).description, description)
Beispiel #13
0
    def test_negative_create_with_invalid_interval(self):
        """Create a sync plan with invalid interval specified.

        :id: f5844526-9f58-4be3-8a96-3849a465fc02

        :expectedresults: A sync plan can not be created with invalid interval
            specified

        :CaseImportance: Critical
        """
        for interval in invalid_values_list():
            with self.subTest(interval):
                with self.assertRaises(HTTPError):
                    entities.SyncPlan(
                        interval=interval,
                        organization=self.org,
                    ).create()
Beispiel #14
0
    def test_positive_create_with_description(self):
        """Create a sync plan with a random description.

        :id: 3e5745e8-838d-44a5-ad61-7e56829ad47c

        :expectedresults: A sync plan is created with the specified
            description.

        :CaseImportance: Critical
        """
        for description in valid_data_list():
            with self.subTest(description):
                sync_plan = entities.SyncPlan(
                    description=description,
                    organization=self.org,
                ).create()
                self.assertEqual(sync_plan.description, description)
Beispiel #15
0
def test_positive_update_enabled(module_org, enabled):
    """Create sync plan and update it with opposite 'enabled' value.

    :id: 325c0ef5-c0e8-4cb9-b85e-87eb7f42c2f8

    :parametrized: yes

    :expectedresults: Sync plan is updated with different 'enabled' value.

    :CaseImportance: Critical
    """
    sync_plan = entities.SyncPlan(enabled=not enabled,
                                  organization=module_org).create()
    sync_plan.enabled = enabled
    sync_plan.update(['enabled'])
    sync_plan = sync_plan.read()
    assert sync_plan.enabled == enabled
Beispiel #16
0
    def test_positive_synchronize_custom_product_past_sync_date(self):
        """Create a sync plan with past datetime as a sync date, add a
        custom product and verify the product gets synchronized on the next
        sync occurrence

        :id: 0495cb39-2f15-4b6e-9828-1e9517c5c826

        :expectedresults: Product is synchronized successfully.

        :BZ: 1279539

        :CaseLevel: System
        """
        interval = 60 * 60  # 'hourly' sync interval in seconds
        delay = 4 * 60
        product = entities.Product(organization=self.org).create()
        repo = entities.Repository(product=product).create()
        # Create and Associate sync plan with product
        sync_plan = entities.SyncPlan(
            organization=self.org,
            enabled=True,
            interval=u'hourly',
            sync_date=datetime.utcnow() - timedelta(seconds=interval - delay),
        ).create()
        sync_plan.add_products(data={'product_ids': [product.id]})
        # Verify product is not synced and doesn't have any content
        self.logger.info('Waiting {0} seconds to check product {1}'
                         ' was not synced'.format(delay / 4, product.name))
        sleep(delay / 4)
        with self.assertRaises(AssertionError):
            self.validate_task_status(repo.id, max_tries=2)
        self.validate_repo_content(repo,
                                   ['erratum', 'package', 'package_group'],
                                   after_sync=False)
        # Wait until the next recurrence
        self.logger.info('Waiting {0} seconds to check product {1}'
                         ' was synced'.format(delay, product.name))
        sleep(delay * 3 / 4)
        # Update with the current UTC time
        sync_plan.sync_date = datetime.utcnow() + timedelta(seconds=delay)
        sync_plan.update(['sync_date'])
        # Verify product was synced successfully
        self.validate_task_status(repo.id,
                                  repo_backend_id=repo.backend_identifier)
        self.validate_repo_content(repo,
                                   ['erratum', 'package', 'package_group'])
Beispiel #17
0
    def test_positive_synchronize_custom_product_weekly_recurrence(self):
        """Create a weekly sync plan with a past datetime as a sync date,
        add a custom product and verify the product gets synchronized on
        the next sync occurrence

        :id: ef52dd8e-756e-429c-8c30-b3e7db2b6d61

        :expectedresults: Product is synchronized successfully.

        :BZ: 1396647

        :CaseLevel: System
        """
        delay = 4 * 60
        start_date = datetime.utcnow().replace(second=0) - timedelta(weeks=1)\
            + timedelta(seconds=delay)
        product = entities.Product(organization=self.org).create()
        repo = entities.Repository(product=product).create()
        # Create and Associate sync plan with product
        sync_plan = entities.SyncPlan(
            organization=self.org,
            enabled=True,
            interval=u'weekly',
            sync_date=start_date,
        ).create()
        sync_plan.add_products(data={'product_ids': [product.id]})
        # Wait quarter of expected time
        self.logger.info('Waiting {0} seconds to check product {1}'
                         ' was not synced'.format(delay / 4, product.name))
        sleep(delay / 4)
        # Verify product is not synced and doesn't have any content
        with self.assertRaises(AssertionError):
            self.validate_task_status(repo.id, max_tries=2)
        self.validate_repo_content(repo,
                                   ['erratum', 'package', 'package_group'],
                                   after_sync=False)
        # Wait the rest of expected time
        self.logger.info('Waiting {0} seconds to check product {1}'
                         ' was synced'.format(delay, product.name))
        sleep(delay * 3 / 4)
        # Verify product was synced successfully
        self.validate_task_status(repo.id,
                                  repo_backend_id=repo.backend_identifier)
        self.validate_repo_content(repo,
                                   ['erratum', 'package', 'package_group'])
Beispiel #18
0
    def test_positive_synchronize_custom_products_future_sync_date(self):
        """Create a sync plan with sync date in a future and sync multiple
        custom products with multiple repos automatically.

        :id: e646196e-3951-4297-8c3c-1494d9895347

        :expectedresults: Products are synchronized successfully.

        :CaseLevel: System

        :BZ: 1695733
        """
        delay = 2 * 60  # delay for sync date in seconds
        products = [entities.Product(organization=self.org).create() for _ in range(3)]
        repos = [
            entities.Repository(product=product).create() for product in products for _ in range(2)
        ]
        # Verify products have not been synced yet
        for repo in repos:
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id)
        # Create and Associate sync plan with products
        if is_open('BZ:1695733'):
            self.logger.info('Need to set seconds to zero because BZ#1695733')
            sync_date = datetime.utcnow().replace(second=0) + timedelta(seconds=delay)
        else:
            sync_date = datetime.utcnow() + timedelta(seconds=delay)
        sync_plan = entities.SyncPlan(
            organization=self.org, enabled=True, sync_date=sync_date
        ).create()
        sync_plan.add_products(data={'product_ids': [product.id for product in products]})
        # Wait quarter of expected time
        self.logger.info('Waiting {0} seconds to check products were not synced'.format(delay / 4))
        sleep(delay / 4)
        # Verify products has not been synced yet
        for repo in repos:
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id, max_tries=1)
        # Wait the rest of expected time
        self.logger.info('Waiting {0} seconds to check products were synced'.format(delay * 3 / 4))
        sleep(delay * 3 / 4)
        # Verify product was synced successfully
        for repo in repos:
            self.validate_task_status(repo.id, repo_backend_id=repo.backend_identifier)
            self.validate_repo_content(repo, ['erratum', 'package', 'package_group'])
Beispiel #19
0
def test_positive_delete_synced_product(module_org):
    """Create a sync plan with one synced product and delete it.

    :id: 195d8fec-1fa0-42ab-84a5-32dd81a285ca

    :expectedresults: A sync plan is created with one synced product and
        sync plan can be deleted.

    :CaseLevel: Integration
    """
    sync_plan = entities.SyncPlan(organization=module_org).create()
    product = entities.Product(organization=module_org).create()
    entities.Repository(product=product).create()
    sync_plan.add_products(data={'product_ids': [product.id]})
    product.sync()
    sync_plan.delete()
    with pytest.raises(HTTPError):
        sync_plan.read()
    def test_positive_delete_products(self):
        """Create a sync plan with two products and delete them.

        @Assert: A sync plan is created with one product and sync plan can be
        deleted.

        @Feature: SyncPlan
        """
        sync_plan = entities.SyncPlan(organization=self.org).create()
        products = [
            entities.Product(organization=self.org).create() for _ in range(2)
        ]
        sync_plan.add_products(data={
            'product_ids': [product.id for product in products],
        })
        sync_plan.delete()
        with self.assertRaises(HTTPError):
            sync_plan.read()
Beispiel #21
0
    def test_positive_update_enabled(self):
        """Create sync plan and update it with opposite 'enabled' value.

        :id: 325c0ef5-c0e8-4cb9-b85e-87eb7f42c2f8

        :expectedresults: Sync plan is updated with different 'enabled' value.

        :CaseImportance: Critical
        """
        for enabled in (False, True):
            with self.subTest(enabled):
                sync_plan = entities.SyncPlan(
                    enabled=not enabled,
                    organization=self.org,
                ).create()
                sync_plan.enabled = enabled
                self.assertEqual(
                    sync_plan.update(['enabled']).enabled, enabled)
Beispiel #22
0
    def test_positive_delete_synced_product(self):
        """Create a sync plan with one synced product and delete it.

        @id: 195d8fec-1fa0-42ab-84a5-32dd81a285ca

        @Assert: A sync plan is created with one synced product and sync plan
        can be deleted.

        @CaseLevel: Integration
        """
        sync_plan = entities.SyncPlan(organization=self.org).create()
        product = entities.Product(organization=self.org).create()
        entities.Repository(product=product).create()
        sync_plan.add_products(data={'product_ids': [product.id]})
        product.sync()
        sync_plan.delete()
        with self.assertRaises(HTTPError):
            sync_plan.read()
Beispiel #23
0
    def test_positive_update_sync_date(self):
        """Updated sync plan's sync date.

        :id: fad472c7-01b4-453b-ae33-0845c9e0dfd4

        :expectedresults: Sync date is updated with the specified sync date.

        :CaseImportance: Critical
        """
        sync_plan = entities.SyncPlan(
            organization=self.org,
            sync_date=datetime.now() + timedelta(days=10),
        ).create()
        for syncdate in valid_sync_dates():
            with self.subTest(syncdate):
                sync_plan.sync_date = syncdate
                self.assertEqual(syncdate.strftime('%Y-%m-%d %H:%M:%S UTC'),
                                 sync_plan.update(['sync_date']).sync_date)
Beispiel #24
0
    def test_positive_update_interval(self):
        """Create a sync plan and update its interval.

        @id: cf2eddf8-b4db-430e-a9b0-83c626b45068

        @Assert: A sync plan is created and its interval can be updated with
        the specified interval.
        """
        for interval in valid_sync_interval():
            with self.subTest(interval):
                sync_plan = entities.SyncPlan(organization=self.org)
                result = sync_plan.get_fields()['interval']
                sync_plan.interval = sample(
                    set(result.choices) - set([interval]), 1)[0]
                sync_plan = sync_plan.create()
                sync_plan.interval = interval
                self.assertEqual(
                    sync_plan.update(['interval']).interval, interval)
Beispiel #25
0
def test_positive_add_product(module_org):
    """Create a sync plan and add one product to it.

    :id: 036dea02-f73d-4fc1-9c41-5515b6659c79

    :expectedresults: A sync plan can be created and one product can be
        added to it.

    :CaseLevel: Integration

    :CaseImportance: Critical
    """
    syncplan = entities.SyncPlan(organization=module_org).create()
    product = entities.Product(organization=module_org).create()
    syncplan.add_products(data={'product_ids': [product.id]})
    syncplan = syncplan.read()
    assert len(syncplan.product) == 1
    assert syncplan.product[0].id == product.id
Beispiel #26
0
def test_positive_update_sync_date(module_org, syncdate):
    """Updated sync plan's sync date.

    :id: fad472c7-01b4-453b-ae33-0845c9e0dfd4

    :parametrized: yes

    :expectedresults: Sync date is updated with the specified sync date.

    :CaseImportance: Critical
    """
    sync_plan = entities.SyncPlan(organization=module_org,
                                  sync_date=datetime.now() +
                                  timedelta(days=10)).create()
    sync_plan.sync_date = syncdate
    sync_plan.update(['sync_date'])
    sync_plan = sync_plan.read()
    assert syncdate.strftime('%Y-%m-%d %H:%M:%S UTC') == sync_plan.sync_date
Beispiel #27
0
    def test_positive_synchronize_custom_product_future_sync_date(self):
        """Create a sync plan with sync date in a future and sync one custom
        product with it automatically.

        :id: b70a0c50-7335-4285-b24c-edfc1187f034

        :expectedresults: Product is synchronized successfully.

        :CaseLevel: System
        """
        delay = 4 * 60  # delay for sync date in seconds
        sync_plan = entities.SyncPlan(
            organization=self.org,
            enabled=True,
            sync_date=datetime.utcnow() + timedelta(seconds=delay),
        ).create()
        product = entities.Product(organization=self.org).create()
        repo = entities.Repository(product=product).create()
        # Verify product is not synced and doesn't have any content
        with self.assertRaises(AssertionError):
            self.validate_task_status(repo.id, max_tries=2)
        self.validate_repo_content(repo,
                                   ['erratum', 'package', 'package_group'],
                                   after_sync=False)
        # Associate sync plan with product
        sync_plan.add_products(data={'product_ids': [product.id]})
        # Wait half of expected time
        self.logger.info('Waiting {0} seconds to check product {1}'
                         ' was not synced'.format(delay / 4, product.name))
        sleep(delay / 4)
        # Verify product has not been synced yet
        with self.assertRaises(AssertionError):
            self.validate_task_status(repo.id, max_tries=2)
        self.validate_repo_content(repo,
                                   ['erratum', 'package', 'package_group'],
                                   after_sync=False)
        # Wait the rest of expected time
        self.logger.info('Waiting {0} seconds to check product {1}'
                         ' was synced'.format(delay, product.name))
        sleep(delay * 3 / 4)
        # Verify product was synced successfully
        self.validate_task_status(repo.id)
        self.validate_repo_content(repo,
                                   ['erratum', 'package', 'package_group'])
Beispiel #28
0
def test_positive_synchronize_custom_product_past_sync_date(module_org):
    """Create a sync plan with past datetime as a sync date, add a
    custom product and verify the product gets synchronized on the next
    sync occurrence

    :id: 0495cb39-2f15-4b6e-9828-1e9517c5c826

    :expectedresults: Product is synchronized successfully.

    :BZ: 1279539

    :CaseLevel: System
    """
    interval = 60 * 60  # 'hourly' sync interval in seconds
    delay = 2 * 60
    product = entities.Product(organization=module_org).create()
    repo = entities.Repository(product=product).create()
    # Create and Associate sync plan with product
    sync_plan = entities.SyncPlan(
        organization=module_org,
        enabled=True,
        interval='hourly',
        sync_date=datetime.utcnow().replace(second=0) - timedelta(seconds=interval - delay),
    ).create()
    sync_plan.add_products(data={'product_ids': [product.id]})
    # Wait quarter of expected time
    logger.info(
        f"Waiting {(delay / 4)} seconds to check product {product.name}"
        f" was not synced by {sync_plan.name}"
    )
    sleep(delay / 4)
    # Verify product is not synced and doesn't have any content
    with pytest.raises(AssertionError):
        validate_task_status(repo.id, module_org.id, max_tries=1)
    validate_repo_content(repo, ['erratum', 'package', 'package_group'], after_sync=False)
    # Wait until the next recurrence
    logger.info(
        f"Waiting {(delay * 3 / 4)} seconds to check product {product.name}"
        f" was synced by {sync_plan.name}"
    )
    sleep(delay * 3 / 4)
    # Verify product was synced successfully
    validate_task_status(repo.id, module_org.id)
    validate_repo_content(repo, ['erratum', 'package', 'package_group'])
Beispiel #29
0
def test_positive_repeatedly_add_remove(module_org):
    """Repeatedly add and remove a product from a sync plan.

    :id: b67536ba-3a36-4bb7-a405-0e12081d5a7e

    :expectedresults: A task is returned which can be used to monitor the
        additions and removals.

    :CaseLevel: Integration

    :BZ: 1199150
    """
    syncplan = entities.SyncPlan(organization=module_org).create()
    product = entities.Product(organization=module_org).create()
    for _ in range(5):
        syncplan.add_products(data={'product_ids': [product.id]})
        assert len(syncplan.read().product) == 1
        syncplan.remove_products(data={'product_ids': [product.id]})
        assert len(syncplan.read().product) == 0
Beispiel #30
0
def test_positive_create_with_interval(module_org, interval):
    """Create a sync plan with a random interval.

    :id: d160ed1c-b698-42dc-be0b-67ac693c7840

    :parametrized: yes

    :expectedresults: A sync plan is created with the specified interval.

    :CaseImportance: Critical
    """
    sync_plan = entities.SyncPlan(description=gen_string('alpha'),
                                  organization=module_org,
                                  interval=interval)
    if interval == SYNC_INTERVAL['custom']:
        sync_plan.cron_expression = gen_choice(valid_cron_expressions())
    sync_plan = sync_plan.create()
    sync_plan = sync_plan.read()
    assert sync_plan.interval == interval