Exemplo n.º 1
0
    def test_positive_delete_by_id(self):
        """Check if syncplan can be created and deleted

        @Feature: Sync Plan

        @Assert: Sync plan is created and then deleted
        """
        for name in valid_data_list():
            with self.subTest(name):
                new_sync_plan = self._make_sync_plan({u'name': name})
                SyncPlan.delete({u'id': new_sync_plan['id']})
                with self.assertRaises(CLIReturnCodeError):
                    SyncPlan.info({'id': new_sync_plan['id']})
Exemplo n.º 2
0
    def test_positive_delete_by_id(self):
        """Check if syncplan can be created and deleted

        @id: b5d97c6b-aead-422b-8d9f-4a192bbe4a3b

        @Assert: Sync plan is created and then deleted
        """
        for name in valid_data_list():
            with self.subTest(name):
                new_sync_plan = self._make_sync_plan({u'name': name})
                SyncPlan.delete({u'id': new_sync_plan['id']})
                with self.assertRaises(CLIReturnCodeError):
                    SyncPlan.info({'id': new_sync_plan['id']})
Exemplo n.º 3
0
def test_positive_delete_by_id(module_org, name):
    """Check if syncplan can be created and deleted

    :id: b5d97c6b-aead-422b-8d9f-4a192bbe4a3b

    :parametrized: yes

    :expectedresults: Sync plan is created and then deleted

    :CaseImportance: Critical
    """
    new_sync_plan = make_sync_plan({'name': name, 'organization-id': module_org.id})
    SyncPlan.delete({'id': new_sync_plan['id']})
    with pytest.raises(CLIReturnCodeError):
        SyncPlan.info({'id': new_sync_plan['id']})
Exemplo n.º 4
0
    def test_positive_delete_by_id(self):
        """Check if syncplan can be created and deleted

        :id: b5d97c6b-aead-422b-8d9f-4a192bbe4a3b

        :expectedresults: Sync plan is created and then deleted

        :CaseImportance: Critical
        """
        for name in valid_data_list():
            with self.subTest(name):
                new_sync_plan = self._make_sync_plan({u'name': name})
                SyncPlan.delete({u'id': new_sync_plan['id']})
                with self.assertRaises(CLIReturnCodeError):
                    SyncPlan.info({'id': new_sync_plan['id']})
Exemplo n.º 5
0
    def test_positive_info_with_assigned_product(self):
        """Verify that sync plan info command returns list of products which
        are assigned to that sync plan

        :id: 7a7e5e40-7776-4d26-9173-73f00de6e8e9

        :expectedresults: Expected product information is returned in info
            command

        :BZ: 1390545
        """
        prod1 = gen_string('alpha')
        prod2 = gen_string('alpha')
        sync_plan = self._make_sync_plan({
            'enabled': 'false',
            'organization-id': self.org['id'],
            'sync-date': datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S"),
        })
        for prod_name in [prod1, prod2]:
            product = make_product({
                'organization-id': self.org['id'],
                'name': prod_name,
            })
            Product.set_sync_plan({
                'id': product['id'],
                'sync-plan-id': sync_plan['id'],
            })
        updated_plan = SyncPlan.info({'id': sync_plan['id']})
        self.assertEqual(len(updated_plan['products']), 2)
        self.assertEqual(
            set(prod['name'] for prod in updated_plan['products']),
            set([prod1, prod2])
        )
Exemplo n.º 6
0
    def test_positive_info_with_assigned_product(self):
        """Verify that sync plan info command returns list of products which
        are assigned to that sync plan

        :id: 7a7e5e40-7776-4d26-9173-73f00de6e8e9

        :customerscenario: true

        :expectedresults: Expected product information is returned in info
            command

        :BZ: 1390545
        """
        prod1 = gen_string('alpha')
        prod2 = gen_string('alpha')
        sync_plan = self._make_sync_plan({
            'enabled': 'false',
            'organization-id': self.org['id'],
            'sync-date': datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S"),
        })
        for prod_name in [prod1, prod2]:
            product = make_product({
                'organization-id': self.org['id'],
                'name': prod_name,
            })
            Product.set_sync_plan({
                'id': product['id'],
                'sync-plan-id': sync_plan['id'],
            })
        updated_plan = SyncPlan.info({'id': sync_plan['id']})
        self.assertEqual(len(updated_plan['products']), 2)
        self.assertEqual(
            set(prod['name'] for prod in updated_plan['products']),
            set([prod1, prod2])
        )
Exemplo n.º 7
0
def test_positive_info_with_assigned_product(module_org):
    """Verify that sync plan info command returns list of products which
    are assigned to that sync plan

    :id: 7a7e5e40-7776-4d26-9173-73f00de6e8e9

    :customerscenario: true

    :expectedresults: Expected product information is returned in info
        command

    :BZ: 1390545

    :CaseImportance: Critical

    :CaseLevel: Integration
    """
    prod1 = gen_string('alpha')
    prod2 = gen_string('alpha')
    sync_plan = make_sync_plan(
        {
            'enabled': 'false',
            'organization-id': module_org.id,
            'sync-date': datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S"),
        }
    )
    for prod_name in [prod1, prod2]:
        product = make_product({'organization-id': module_org.id, 'name': prod_name})
        Product.set_sync_plan({'id': product['id'], 'sync-plan-id': sync_plan['id']})
    updated_plan = SyncPlan.info({'id': sync_plan['id']})
    assert len(updated_plan['products']) == 2
    assert {prod['name'] for prod in updated_plan['products']} == {prod1, prod2}
Exemplo n.º 8
0
    def test_positive_delete_1(self, test_data):
        """@Test: Check if syncplan can be created and deleted

        @Feature: Sync Plan

        @Assert: Sync plan is created and then deleted

        """

        new_sync_plan = self._make_sync_plan({u'name': test_data['name']})
        # Assert that name matches data passed
        self.assertEqual(new_sync_plan['name'], test_data['name'],
                         "Names don't match")

        # Delete it
        result = SyncPlan.delete({u'id': new_sync_plan['id']})
        self.assertEqual(result.return_code, 0, "Sync plan was not deleted")
        self.assertEqual(len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = SyncPlan.info({
            'id': new_sync_plan['id'],
        })
        self.assertNotEqual(result.return_code, 0,
                            "Sync plan should not be found")
        self.assertGreater(len(result.stderr), 0, "Expected an error here")
Exemplo n.º 9
0
    def _make_sync_plan(self, options=None):
        """
        Make a sync plan and asserts its success
        """

        if options is None:
            options = {}

        if not options.get('organization-id', None):
            options[u'organization-id'] = self.org['id']

        new_sync_plan = make_sync_plan(options)

        # Fetch it
        result = SyncPlan.info(
            {
                u'id': new_sync_plan['id']
            }
        )

        self.assertEqual(
            result.return_code,
            0,
            "Sync plan was not found")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")

        # Return the sync plan dictionary
        return new_sync_plan
Exemplo n.º 10
0
def test_positive_update_sync_date(module_org):
    """Check if syncplan sync date can be updated

    :id: f0c17d7d-3e86-4b64-9747-6cba6809815e

    :expectedresults: Sync plan is created and sync plan is updated

    :BZ: 1336790

    :CaseImportance: Critical
    """
    # Set the sync date to today/right now
    today = datetime.now()
    sync_plan_name = gen_string('alphanumeric')
    new_sync_plan = make_sync_plan({
        'name': sync_plan_name,
        'sync-date': today.strftime(SYNC_DATE_FMT),
        'organization-id': module_org.id,
    })
    # Assert that sync date matches data passed
    assert new_sync_plan['start-date'] == today.strftime("%Y/%m/%d %H:%M:%S")
    # Set sync date 5 days in the future
    future_date = today + timedelta(days=5)
    # Update sync interval
    SyncPlan.update({
        'id': new_sync_plan['id'],
        'sync-date': future_date.strftime(SYNC_DATE_FMT)
    })
    # Fetch it
    result = SyncPlan.info({'id': new_sync_plan['id']})
    assert result['start-date'] != new_sync_plan['start-date']
    assert datetime.strptime(
        result['start-date'], '%Y/%m/%d %H:%M:%S') > datetime.strptime(
            new_sync_plan['start-date'],
            '%Y/%m/%d %H:%M:%S'), 'Sync date was not updated'
Exemplo n.º 11
0
    def test_positive_update_1(self, test_data):
        """@Test: Check if syncplan description can be updated

        @Feature: Sync Plan

        @Assert: Sync plan is created and description is updated

        """
        new_sync_plan = self._make_sync_plan()
        # Assert that description matches data passed
        self.assertNotEqual(
            new_sync_plan['description'],
            test_data['description'],
        )
        # Update sync plan
        SyncPlan.update({
            u'description': test_data['description'],
            u'id': new_sync_plan['id'],
        })
        # Fetch it
        result = SyncPlan.info({u'id': new_sync_plan['id']})
        # Assert that description matches new value
        self.assertEqual(result['description'], test_data['description'])
        # Assert that description does not matches original value
        self.assertNotEqual(
            new_sync_plan['description'],
            result['description'],
        )
Exemplo n.º 12
0
    def test_positive_update_2(self, test_data):
        """@Test: Check if syncplan interval be updated

        @Feature: Sync Plan

        @Assert: Sync plan interval is updated

        """
        new_sync_plan = self._make_sync_plan({
            u'interval': test_data['interval'],
            u'name': test_data['name'],
        })
        # Assert that name and interval matches data passed
        self.assertEqual(new_sync_plan['name'], test_data['name'])
        self.assertEqual(new_sync_plan['interval'], test_data['interval'])
        # Update sync interval
        SyncPlan.update({
            u'id': new_sync_plan['id'],
            u'interval': test_data['new-interval'],
        })
        # Fetch it
        result = SyncPlan.info({u'id': new_sync_plan['id']})
        # Assert that interval was updated
        self.assertEqual(result['interval'], test_data['new-interval'])
        self.assertNotEqual(new_sync_plan['interval'], result['interval'])
Exemplo n.º 13
0
    def test_positive_delete_1(self, test_data):
        """@Test: Check if syncplan can be created and deleted

        @Feature: Sync Plan

        @Assert: Sync plan is created and then deleted

        """
        new_sync_plan = self._make_sync_plan({u'name': test_data['name']})
        # Assert that name matches data passed
        self.assertEqual(new_sync_plan['name'], test_data['name'])
        # Delete it
        SyncPlan.delete({u'id': new_sync_plan['id']})
        # Fetch it
        with self.assertRaises(CLIReturnCodeError):
            SyncPlan.info({'id': new_sync_plan['id']})
Exemplo n.º 14
0
    def test_positive_update_1(self, test_data):
        """@Test: Check if syncplan description can be updated

        @Feature: Sync Plan

        @Assert: Sync plan is created and description is updated

        """

        new_sync_plan = self._make_sync_plan()
        # Assert that description matches data passed
        self.assertNotEqual(
            new_sync_plan['description'],
            test_data['description'],
            "Descriptions don't match"
        )

        # Update sync plan
        result = SyncPlan.update(
            {
                u'id': new_sync_plan['id'],
                u'description': test_data['description']
            }
        )
        self.assertEqual(
            result.return_code,
            0,
            "Sync plan was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = SyncPlan.info(
            {
                u'id': new_sync_plan['id'],
            }
        )
        self.assertEqual(
            result.return_code,
            0,
            "Sync plan was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")
        # Assert that description matches new value
        self.assertIsNotNone(
            result.stdout.get('description', None),
            "The description field was not returned"
        )
        self.assertEqual(
            result.stdout['description'],
            test_data['description'],
            "Descriptions should match"
        )
        # Assert that description does not matches original value
        self.assertNotEqual(
            new_sync_plan['description'],
            result.stdout['description'],
            "Descriptions should not match"
        )
Exemplo n.º 15
0
    def test_positive_update_3(self, test_data):
        """@Test: Check if syncplan sync date can be updated

        @Feature: Sync Plan

        @Assert: Sync plan is created and sync plan is updated

        """

        # Set the sync date to today/right now
        today = datetime.now()
        new_sync_plan = self._make_sync_plan({
            u'name': test_data['name'],
            u'sync-date': today.strftime("%Y-%m-%d %H:%M:%S"),
        })
        # Assert that sync date matches data passed
        self.assertEqual(
            new_sync_plan['start-date'],
            today.strftime("%Y/%m/%d %H:%M:%S"),
        )

        # Set sync date 5 days in the future
        future_date = today + timedelta(days=5)
        # Update sync interval
        result = SyncPlan.update({
            u'id': new_sync_plan['id'],
            u'sync-date': future_date.strftime("%Y-%m-%d %H:%M:%S"),
        })
        self.assertEqual(
            result.return_code,
            0,
            "Sync plan was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = SyncPlan.info({
            u'id': new_sync_plan['id'],
        })
        self.assertEqual(
            result.return_code,
            0,
            "Sync plan was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")
        self.assertNotEqual(
            result.stdout['start-date'],
            new_sync_plan['start-date'],
            "Sync date was not updated"
        )
        self.assertGreater(
            datetime.strptime(
                result.stdout['start-date'],
                "%Y/%m/%d %H:%M:%S"),
            datetime.strptime(
                new_sync_plan['start-date'],
                "%Y/%m/%d %H:%M:%S"),
            "Sync date was not updated"
        )
Exemplo n.º 16
0
    def test_positive_info_enabled_field_is_displayed(self):
        """Check if Enabled field is displayed in sync-plan info output

        @id: 54e3a4ea-315c-4026-8101-c4605ca6b874

        @Assert: Sync plan Enabled state is displayed
        """
        new_sync_plan = self._make_sync_plan()
        result = SyncPlan.info({'id': new_sync_plan['id']})
        self.assertIsNotNone(result.get('enabled'))
Exemplo n.º 17
0
    def test_positive_info_enabled_field_is_displayed(self):
        """Check if Enabled field is displayed in sync-plan info output

        @Feature: Sync Plan Info

        @Assert: Sync plan Enabled state is displayed
        """
        new_sync_plan = self._make_sync_plan()
        result = SyncPlan.info({'id': new_sync_plan['id']})
        self.assertIsNotNone(result.get('enabled'))
Exemplo n.º 18
0
    def test_positive_info_enabled_field_is_displayed(self):
        """Check if Enabled field is displayed in sync-plan info output

        @id: 54e3a4ea-315c-4026-8101-c4605ca6b874

        @Assert: Sync plan Enabled state is displayed
        """
        new_sync_plan = self._make_sync_plan()
        result = SyncPlan.info({'id': new_sync_plan['id']})
        self.assertIsNotNone(result.get('enabled'))
Exemplo n.º 19
0
def test_positive_info_enabled_field_is_displayed(module_org):
    """Check if Enabled field is displayed in sync-plan info output

    :id: 54e3a4ea-315c-4026-8101-c4605ca6b874

    :expectedresults: Sync plan Enabled state is displayed

    :CaseImportance: Critical
    """
    new_sync_plan = make_sync_plan({'organization-id': module_org.id})
    result = SyncPlan.info({'id': new_sync_plan['id']})
    assert result.get('enabled') is not None
Exemplo n.º 20
0
    def test_verify_bugzilla_1261122(self):
        """Check if Enabled field is displayed in sync-plan info output

        @Feature: Sync Plan Info

        @Assert: Sync plan Enabled state is displayed

        @BZ: 1261122
        """
        new_sync_plan = self._make_sync_plan()
        result = SyncPlan.info({'id': new_sync_plan['id']})
        self.assertIsNotNone(result.get('enabled'))
Exemplo n.º 21
0
    def test_verify_bugzilla_1261122(self):
        """Check if Enabled field is displayed in sync-plan info output

        @Feature: Sync Plan Info

        @Assert: Sync plan Enabled state is displayed

        @BZ: 1261122
        """
        new_sync_plan = self._make_sync_plan()
        result = SyncPlan.info({'id': new_sync_plan['id']})
        self.assertIsNotNone(result.get('enabled'))
Exemplo n.º 22
0
    def test_bz1261122_enabled_state_visible(self):
        """@Test: Check if Enabled field is displayed in sync-plan info output

        @Feature: Sync Plan Info

        @Assert: Sync plan Enabled state is displayed

        @BZ: 1261122
        """
        new_sync_plan = self._make_sync_plan()
        result = SyncPlan.info({'id': new_sync_plan['id']})
        self.assertIsNotNone(result.get('enabled'))
Exemplo n.º 23
0
def test_positive_update_description(module_org, new_desc):
    """Check if syncplan description can be updated

    :id: 00a279cd-1f49-4ebb-a59a-6f0b4e4cb83c

    :parametrized: yes

    :expectedresults: Sync plan is created and description is updated
    """
    new_sync_plan = make_sync_plan({'organization-id': module_org.id})
    SyncPlan.update({'description': new_desc, 'id': new_sync_plan['id']})
    result = SyncPlan.info({'id': new_sync_plan['id']})
    assert result['description'] == new_desc
Exemplo n.º 24
0
    def test_positive_update_3(self, test_data):
        """@Test: Check if syncplan sync date can be updated

        @Feature: Sync Plan

        @Assert: Sync plan is created and sync plan is updated

        """

        # Set the sync date to today/right now
        today = datetime.now()
        new_sync_plan = self._make_sync_plan({
            u'name':
            test_data['name'],
            u'sync-date':
            today.strftime("%Y-%m-%d %H:%M:%S"),
        })
        # Assert that sync date matches data passed
        self.assertEqual(
            new_sync_plan['start-date'],
            today.strftime("%Y/%m/%d %H:%M:%S"),
        )

        # Set sync date 5 days in the future
        future_date = today + timedelta(days=5)
        # Update sync interval
        result = SyncPlan.update({
            u'id':
            new_sync_plan['id'],
            u'sync-date':
            future_date.strftime("%Y-%m-%d %H:%M:%S"),
        })
        self.assertEqual(result.return_code, 0, "Sync plan was not updated")
        self.assertEqual(len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = SyncPlan.info({
            u'id': new_sync_plan['id'],
        })
        self.assertEqual(result.return_code, 0, "Sync plan was not updated")
        self.assertEqual(len(result.stderr), 0, "No error was expected")
        self.assertNotEqual(result.stdout['start-date'],
                            new_sync_plan['start-date'],
                            "Sync date was not updated")
        self.assertGreater(
            datetime.strptime(result.stdout['start-date'],
                              "%Y/%m/%d %H:%M:%S"),
            datetime.strptime(new_sync_plan['start-date'],
                              "%Y/%m/%d %H:%M:%S"),
            "Sync date was not updated")
Exemplo n.º 25
0
def test_positive_create_with_description(module_org, desc):
    """Check if syncplan can be created with random description

    :id: a1bbe81b-60f5-4a19-b400-a02a23fa1dfa

    :parametrized: yes

    :expectedresults: Sync plan is created and has random description

    :CaseImportance: Critical
    """
    new_sync_plan = make_sync_plan({'description': desc, 'organization-id': module_org.id})
    result = SyncPlan.info({'id': new_sync_plan['id']})
    assert result['description'] == desc
Exemplo n.º 26
0
def test_positive_create_with_name(module_org, name):
    """Check if syncplan can be created with random names

    :id: dc0a86f7-4219-427e-92fd-29352dbdbfce

    :parametrized: yes

    :expectedresults: Sync plan is created and has random name

    :CaseImportance: Critical
    """
    sync_plan = make_sync_plan({'name': name, 'organization-id': module_org.id})
    result = SyncPlan.info({'id': sync_plan['id']})
    assert result['name'] == name
Exemplo n.º 27
0
    def test_positive_update_sync_date(self):
        """Check if syncplan sync date can be updated

        :id: f0c17d7d-3e86-4b64-9747-6cba6809815e

        :expectedresults: Sync plan is created and sync plan is updated

        :BZ: 1336790

        :CaseImportance: Critical
        """
        # Set the sync date to today/right now
        today = datetime.now()
        sync_plan_name = gen_string('alphanumeric')
        new_sync_plan = self._make_sync_plan({
            u'name':
            sync_plan_name,
            u'sync-date':
            today.strftime("%Y-%m-%d %H:%M:%S"),
        })
        # Assert that sync date matches data passed
        self.assertEqual(
            new_sync_plan['start-date'],
            today.strftime("%Y/%m/%d %H:%M:%S"),
        )
        # Set sync date 5 days in the future
        future_date = today + timedelta(days=5)
        # Update sync interval
        SyncPlan.update({
            u'id':
            new_sync_plan['id'],
            u'sync-date':
            future_date.strftime("%Y-%m-%d %H:%M:%S"),
        })
        # Fetch it
        result = SyncPlan.info({
            u'id': new_sync_plan['id'],
        })
        self.assertNotEqual(result['start-date'], new_sync_plan['start-date'])
        self.assertGreater(
            datetime.strptime(
                result['start-date'],
                '%Y/%m/%d %H:%M:%S',
            ),
            datetime.strptime(
                new_sync_plan['start-date'],
                '%Y/%m/%d %H:%M:%S',
            ),
            'Sync date was not updated',
        )
Exemplo n.º 28
0
    def test_positive_update_description(self):
        """Check if syncplan description can be updated

        @id: 00a279cd-1f49-4ebb-a59a-6f0b4e4cb83c

        @Assert: Sync plan is created and description is updated
        """
        new_sync_plan = self._make_sync_plan()
        for new_desc in valid_data_list():
            with self.subTest(new_desc):
                SyncPlan.update({
                    u'description': new_desc,
                    u'id': new_sync_plan['id'],
                })
                result = SyncPlan.info({u'id': new_sync_plan['id']})
                self.assertEqual(result['description'], new_desc)
Exemplo n.º 29
0
    def test_positive_update_description(self):
        """Check if syncplan description can be updated

        @Feature: Sync Plan

        @Assert: Sync plan is created and description is updated
        """
        new_sync_plan = self._make_sync_plan()
        for new_desc in valid_data_list():
            with self.subTest(new_desc):
                SyncPlan.update({
                    u'description': new_desc,
                    u'id': new_sync_plan['id'],
                })
                result = SyncPlan.info({u'id': new_sync_plan['id']})
                self.assertEqual(result['description'], new_desc)
Exemplo n.º 30
0
    def test_positive_update_sync_date(self):
        """Check if syncplan sync date can be updated

        :id: f0c17d7d-3e86-4b64-9747-6cba6809815e

        :expectedresults: Sync plan is created and sync plan is updated

        :BZ: 1336790

        :CaseImportance: Critical
        """
        # Set the sync date to today/right now
        today = datetime.now()
        sync_plan_name = gen_string('alphanumeric')
        new_sync_plan = self._make_sync_plan({
            u'name': sync_plan_name,
            u'sync-date': today.strftime("%Y-%m-%d %H:%M:%S"),
        })
        # Assert that sync date matches data passed
        self.assertEqual(
            new_sync_plan['start-date'],
            today.strftime("%Y/%m/%d %H:%M:%S"),
        )
        # Set sync date 5 days in the future
        future_date = today + timedelta(days=5)
        # Update sync interval
        SyncPlan.update({
            u'id': new_sync_plan['id'],
            u'sync-date': future_date.strftime("%Y-%m-%d %H:%M:%S"),
        })
        # Fetch it
        result = SyncPlan.info({
            u'id': new_sync_plan['id'],
        })
        self.assertNotEqual(result['start-date'], new_sync_plan['start-date'])
        self.assertGreater(
            datetime.strptime(
                result['start-date'],
                '%Y/%m/%d %H:%M:%S',
            ),
            datetime.strptime(
                new_sync_plan['start-date'],
                '%Y/%m/%d %H:%M:%S',
            ),
            'Sync date was not updated',
        )
Exemplo n.º 31
0
    def test_positive_update_description(self):
        """Check if syncplan description can be updated

        :id: 00a279cd-1f49-4ebb-a59a-6f0b4e4cb83c

        :expectedresults: Sync plan is created and description is updated

        :CaseImportance: Critical
        """
        new_sync_plan = self._make_sync_plan()
        for new_desc in valid_data_list():
            with self.subTest(new_desc):
                SyncPlan.update({
                    u'description': new_desc,
                    u'id': new_sync_plan['id'],
                })
                result = SyncPlan.info({u'id': new_sync_plan['id']})
                self.assertEqual(result['description'], new_desc)
Exemplo n.º 32
0
    def test_positive_update_interval(self):
        """Check if syncplan interval be updated

        @id: d676d7f3-9f7c-4375-bb8b-277d71af94b4

        @Assert: Sync plan interval is updated
        """
        for test_data in valid_name_interval_update_tests():
            with self.subTest(test_data):
                new_sync_plan = self._make_sync_plan({
                    u'interval': test_data['interval'],
                    u'name': test_data['name'],
                })
                SyncPlan.update({
                    u'id': new_sync_plan['id'],
                    u'interval': test_data['new-interval'],
                })
                result = SyncPlan.info({u'id': new_sync_plan['id']})
                self.assertEqual(result['interval'], test_data['new-interval'])
Exemplo n.º 33
0
    def _make_sync_plan(self, options=None):
        """Make a sync plan and asserts its success"""

        if options is None:
            options = {}

        if not options.get('organization-id', None):
            options[u'organization-id'] = self.org['id']

        new_sync_plan = make_sync_plan(options)

        # Fetch it
        result = SyncPlan.info({u'id': new_sync_plan['id']})

        self.assertEqual(result.return_code, 0, "Sync plan was not found")
        self.assertEqual(len(result.stderr), 0, "No error was expected")

        # Return the sync plan dictionary
        return new_sync_plan
Exemplo n.º 34
0
def test_positive_create_with_interval(module_org, test_data):
    """Check if syncplan can be created with varied intervals

    :id: 32eb0c1d-0c9a-4fb5-a185-68d0d705fbce

    :parametrized: yes

    :expectedresults: Sync plan is created and has selected interval

    :CaseImportance: Critical
    """
    new_sync_plan = make_sync_plan({
        'interval': test_data['interval'],
        'name': test_data['name'],
        'organization-id': module_org.id,
    })
    result = SyncPlan.info({'id': new_sync_plan['id']})
    assert result['name'] == test_data['name']
    assert result['interval'] == test_data['interval']
Exemplo n.º 35
0
    def test_positive_update_interval(self):
        """Check if syncplan interval be updated

        @Feature: Sync Plan

        @Assert: Sync plan interval is updated
        """
        for test_data in valid_name_interval_update_tests():
            with self.subTest(test_data):
                new_sync_plan = self._make_sync_plan({
                    u'interval': test_data['interval'],
                    u'name': test_data['name'],
                })
                SyncPlan.update({
                    u'id': new_sync_plan['id'],
                    u'interval': test_data['new-interval'],
                })
                result = SyncPlan.info({u'id': new_sync_plan['id']})
                self.assertEqual(result['interval'], test_data['new-interval'])
Exemplo n.º 36
0
    def test_positive_delete_1(self, test_data):
        """@Test: Check if syncplan can be created and deleted

        @Feature: Sync Plan

        @Assert: Sync plan is created and then deleted

        """

        new_sync_plan = self._make_sync_plan({u'name': test_data['name']})
        # Assert that name matches data passed
        self.assertEqual(
            new_sync_plan['name'],
            test_data['name'],
            "Names don't match"
        )

        # Delete it
        result = SyncPlan.delete({u'id': new_sync_plan['id']})
        self.assertEqual(
            result.return_code,
            0,
            "Sync plan was not deleted")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = SyncPlan.info(
            {
                'id': new_sync_plan['id'],
            }
        )
        self.assertNotEqual(
            result.return_code,
            0,
            "Sync plan should not be found"
        )
        self.assertGreater(
            len(result.stderr),
            0,
            "Expected an error here"
        )
Exemplo n.º 37
0
    def test_positive_update_3(self):
        """@Test: Check if syncplan sync date can be updated

        @Feature: Sync Plan

        @Assert: Sync plan is created and sync plan is updated
        """
        # Set the sync date to today/right now
        today = datetime.now()
        sync_plan_name = gen_string('alphanumeric')
        new_sync_plan = self._make_sync_plan({
            u'name': sync_plan_name,
            u'sync-date': today.strftime("%Y-%m-%d %H:%M:%S"),
        })
        # Assert that sync date matches data passed
        self.assertEqual(
            new_sync_plan['start-date'],
            today.strftime("%Y/%m/%d %H:%M:%S"),
        )
        # Set sync date 5 days in the future
        future_date = today + timedelta(days=5)
        # Update sync interval
        SyncPlan.update({
            u'id': new_sync_plan['id'],
            u'sync-date': future_date.strftime("%Y-%m-%d %H:%M:%S"),
        })
        # Fetch it
        result = SyncPlan.info({
            u'id': new_sync_plan['id'],
        })
        self.assertNotEqual(result['start-date'], new_sync_plan['start-date'])
        self.assertGreater(
            datetime.strptime(
                result['start-date'],
                '%Y/%m/%d %H:%M:%S',
            ),
            datetime.strptime(
                new_sync_plan['start-date'],
                '%Y/%m/%d %H:%M:%S',
            ),
            'Sync date was not updated',
        )
Exemplo n.º 38
0
def test_positive_update_interval(module_org, test_data):
    """Check if syncplan interval can be updated

    :id: d676d7f3-9f7c-4375-bb8b-277d71af94b4

    :parametrized: yes

    :expectedresults: Sync plan interval is updated

    :CaseImportance: Critical
    """
    new_sync_plan = make_sync_plan(
        {
            'interval': test_data['interval'],
            'name': test_data['name'],
            'organization-id': module_org.id,
        }
    )
    SyncPlan.update({'id': new_sync_plan['id'], 'interval': test_data['new-interval']})
    result = SyncPlan.info({'id': new_sync_plan['id']})
    assert result['interval'] == test_data['new-interval']
Exemplo n.º 39
0
    def test_positive_update_interval(self):
        """Check if syncplan interval be updated

        :id: d676d7f3-9f7c-4375-bb8b-277d71af94b4

        :expectedresults: Sync plan interval is updated

        :CaseImportance: Critical
        """
        for test_data in valid_name_interval_update_tests():
            with self.subTest(test_data):
                new_sync_plan = self._make_sync_plan({
                    u'interval': test_data['interval'],
                    u'name': test_data['name'],
                })
                SyncPlan.update({
                    u'id': new_sync_plan['id'],
                    u'interval': test_data['new-interval'],
                })
                result = SyncPlan.info({u'id': new_sync_plan['id']})
                self.assertEqual(result['interval'], test_data['new-interval'])
Exemplo n.º 40
0
    def test_positive_update_1(self, test_data):
        """@Test: Check if syncplan description can be updated

        @Feature: Sync Plan

        @Assert: Sync plan is created and description is updated

        """

        new_sync_plan = self._make_sync_plan()
        # Assert that description matches data passed
        self.assertNotEqual(new_sync_plan['description'],
                            test_data['description'],
                            "Descriptions don't match")

        # Update sync plan
        result = SyncPlan.update({
            u'id': new_sync_plan['id'],
            u'description': test_data['description']
        })
        self.assertEqual(result.return_code, 0, "Sync plan was not updated")
        self.assertEqual(len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = SyncPlan.info({
            u'id': new_sync_plan['id'],
        })
        self.assertEqual(result.return_code, 0, "Sync plan was not updated")
        self.assertEqual(len(result.stderr), 0, "No error was expected")
        # Assert that description matches new value
        self.assertIsNotNone(result.stdout.get('description', None),
                             "The description field was not returned")
        self.assertEqual(result.stdout['description'],
                         test_data['description'], "Descriptions should match")
        # Assert that description does not matches original value
        self.assertNotEqual(new_sync_plan['description'],
                            result.stdout['description'],
                            "Descriptions should not match")
Exemplo n.º 41
0
    def test_positive_update_2(self, test_data):
        """@Test: Check if syncplan interval be updated

        @Feature: Sync Plan

        @Assert: Sync plan interval is updated

        """

        new_sync_plan = self._make_sync_plan({
            u'name': test_data['name'],
            u'interval': test_data['interval']
        })
        # Assert that name and interval matches data passed
        self.assertEqual(new_sync_plan['name'], test_data['name'],
                         "Descriptions don't match")
        self.assertEqual(new_sync_plan['interval'], test_data['interval'],
                         "Intervals don't match")

        # Update sync interval
        result = SyncPlan.update({
            u'id': new_sync_plan['id'],
            u'interval': test_data['new-interval']
        })
        self.assertEqual(result.return_code, 0, "Sync plan was not updated")
        self.assertEqual(len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = SyncPlan.info({
            u'id': new_sync_plan['id'],
        })
        self.assertEqual(result.return_code, 0, "Sync plan was not updated")
        self.assertEqual(len(result.stderr), 0, "No error was expected")
        # Assert that interval was updated
        self.assertEqual(result.stdout['interval'], test_data['new-interval'],
                         "Intervals don't match")
        self.assertNotEqual(new_sync_plan['interval'],
                            result.stdout['interval'], "Intervals don't match")
Exemplo n.º 42
0
    def test_positive_update_interval(self):
        """Check if syncplan interval be updated

        :id: d676d7f3-9f7c-4375-bb8b-277d71af94b4

        :expectedresults: Sync plan interval is updated

        :CaseImportance: Critical
        """
        for test_data in valid_name_interval_update_tests():
            with self.subTest(test_data):
                new_sync_plan = self._make_sync_plan({
                    'interval':
                    test_data['interval'],
                    'name':
                    test_data['name']
                })
                SyncPlan.update({
                    'id': new_sync_plan['id'],
                    'interval': test_data['new-interval']
                })
                result = SyncPlan.info({'id': new_sync_plan['id']})
                self.assertEqual(result['interval'], test_data['new-interval'])
Exemplo n.º 43
0
    def test_positive_update_2(self, test_data):
        """
        @Test: Check if syncplan interval be updated
        @Feature: Sync Plan
        @Assert: Sync plan interval is updated
        """

        new_sync_plan = self._make_sync_plan(
            {
                u'name': test_data['name'],
                u'interval': test_data['interval']
            })
        # Assert that name and interval matches data passed
        self.assertEqual(
            new_sync_plan['name'],
            test_data['name'],
            "Descriptions don't match"
        )
        self.assertEqual(
            new_sync_plan['interval'],
            test_data['interval'],
            "Intervals don't match"
        )

        # Update sync interval
        result = SyncPlan.update(
            {
                u'id': new_sync_plan['id'],
                u'interval': test_data['new-interval']
            }
        )
        self.assertEqual(
            result.return_code,
            0,
            "Sync plan was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = SyncPlan.info(
            {
                u'id': new_sync_plan['id'],
            }
        )
        self.assertEqual(
            result.return_code,
            0,
            "Sync plan was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")
        # Assert that interval was updated
        self.assertEqual(
            result.stdout['interval'],
            test_data['new-interval'],
            "Intervals don't match"
        )
        self.assertNotEqual(
            new_sync_plan['interval'],
            result.stdout['interval'],
            "Intervals don't match"
        )