コード例 #1
0
    def test_positive_update(self):
        """Create organization and update its name and description

        :id: 66581003-f5d9-443c-8cd6-00f68087e8e9

        :expectedresults: organization name is updated

        :CaseImportance: Critical
        """
        new_name = valid_org_names_list()[0]
        new_desc = valid_data_list()[0]
        org = make_org()

        # upgrade name
        Org.update({
            'id': org['id'],
            'new-name': new_name,
        })
        org = Org.info({'id': org['id']})
        self.assertEqual(org['name'], new_name)

        # upgrade description
        Org.update({
            'description': new_desc,
            'id': org['id'],
        })
        org = Org.info({'id': org['id']})
        self.assertEqual(org['description'], new_desc)
コード例 #2
0
def test_negative_update_name(new_name, module_org):
    """Fail to update organization name for invalid values.

    :id: 582d41b8-370d-45ed-9b7b-8096608e1324

    :parametrized: yes

    :expectedresults: organization name is not updated

    """
    with pytest.raises(CLIReturnCodeError):
        Org.update({'id': module_org.id, 'new-name': new_name})
コード例 #3
0
    def test_negative_update_name(self):
        """Create organization then fail to update its name

        :id: 582d41b8-370d-45ed-9b7b-8096608e1324

        :expectedresults: organization name is not updated

        """
        org = make_org()
        for new_name in invalid_values_list():
            with self.subTest(new_name):
                with self.assertRaises(CLIReturnCodeError):
                    Org.update({'id': org['id'], 'new-name': new_name})
コード例 #4
0
    def _update_cdn_address(self):
        if self.target_url == '':
            raise RuntimeError('Invalid CDN address. Stop!')

        Org.update({
            'id': self.org_id,
            'redhat-repository-url': self.target_url
        })
        result = Org.info({'id': self.org_id})

        if result.return_code != 0:
            self.logger.error('Fail to update CDN address!')
            return
        self.logger.info('RH CDN URL: {}'.format(
            result.stdout['red-hat-repository-url']))
コード例 #5
0
    def _update_cdn_address(self):
        if self.target_url == '':
            raise RuntimeError('Invalid CDN address. Stop!')

        Org.update({
            'id': self.org_id,
            'redhat-repository-url': self.target_url
        })
        result = Org.info({'id': self.org_id})

        if result.return_code != 0:
            self.logger.error('Fail to update CDN address!')
            return
        self.logger.info(
            'RH CDN URL: {}'
            .format(result.stdout['red-hat-repository-url']))
コード例 #6
0
    def _update_cdn_address(self):
        """Utility function to update CDN address from given URL"""
        if self.target_url == '':
            raise RuntimeError('Invalid CDN address. Stop!')

        Org.update({
            'id': self.org_id,
            'redhat-repository-url': self.target_url,
        })
        try:
            result = Org.info({'id': self.org_id})
        except CLIReturnCodeError:
            self.logger.error('Fail to update CDN address!')
            return
        self.logger.info('RH CDN URL: {0}'.format(
            result['red-hat-repository-url']))
コード例 #7
0
    def test_negative_update_name(self):
        """Create organization then fail to update its name

        @id: 582d41b8-370d-45ed-9b7b-8096608e1324

        @assert: organization name is not updated
        """
        for new_name in invalid_values_list():
            with self.subTest(new_name):
                org = make_org()
                # Update the org name
                with self.assertRaises(CLIReturnCodeError):
                    Org.update({
                        'id': org['id'],
                        'new-name': new_name,
                    })
コード例 #8
0
    def test_negative_update_name(self):
        """@test: Create organization then fail to update its name

        @feature: Organization

        @assert: organization name is not updated
        """
        for test_data in invalid_name_data():
            with self.subTest(test_data):
                org = make_org()
                # Update the org name
                with self.assertRaises(CLIReturnCodeError):
                    Org.update({
                        'id': org['id'],
                        'new-name': test_data['name'],
                    })
コード例 #9
0
    def test_negative_update_name(self):
        """Create organization then fail to update its name

        @feature: Organization

        @assert: organization name is not updated
        """
        for new_name in invalid_values_list():
            with self.subTest(new_name):
                org = make_org()
                # Update the org name
                with self.assertRaises(CLIReturnCodeError):
                    Org.update({
                        'id': org['id'],
                        'new-name': new_name,
                    })
コード例 #10
0
    def _update_cdn_address(self):
        """Utility function to update CDN address from given URL"""
        if self.target_url == '':
            raise RuntimeError('Invalid CDN address. Stop!')

        Org.update({
            'id': self.org_id,
            'redhat-repository-url': self.target_url,
        })
        try:
            result = Org.info({'id': self.org_id})
        except CLIReturnCodeError:
            self.logger.error('Fail to update CDN address!')
            return
        self.logger.info(
            'RH CDN URL: {0}'
            .format(result['red-hat-repository-url']))
コード例 #11
0
    def test_positive_update_name(self):
        """Create organization with valid values then update its name

        @id: 66581003-f5d9-443c-8cd6-00f68087e8e9

        @assert: organization name is updated
        """
        for new_name in valid_org_names_list():
            with self.subTest(new_name):
                org = make_org()
                # Update the org name
                Org.update({
                    'id': org['id'],
                    'new-name': new_name,
                })
                # Fetch the org again
                org = Org.info({'id': org['id']})
                self.assertEqual(org['name'], new_name)
コード例 #12
0
    def test_positive_update_name(self):
        """Create organization with valid values then update its name

        @feature: Organization

        @assert: organization name is updated
        """
        for new_name in valid_org_names_list():
            with self.subTest(new_name):
                org = make_org()
                # Update the org name
                Org.update({
                    'id': org['id'],
                    'new-name': new_name,
                })
                # Fetch the org again
                org = Org.info({'id': org['id']})
                self.assertEqual(org['name'], new_name)
コード例 #13
0
    def test_positive_update_description(self):
        """Create organization with valid values then update its description

        @feature: Organization

        @assert: organization description is updated
        """
        for new_desc in valid_data_list():
            with self.subTest(new_desc):
                org = make_org()
                # Update the org name
                Org.update({
                    'description': new_desc,
                    'id': org['id'],
                })
                # Fetch the org again
                org = Org.info({'id': org['id']})
                self.assertEqual(org['description'], new_desc)
コード例 #14
0
    def test_positive_update_name(self):
        """@test: Create organization with valid values then update its name

        @feature: Organization

        @assert: organization name is updated
        """
        for test_data in valid_names():
            with self.subTest(test_data):
                org = make_org()
                # Update the org name
                Org.update({
                    'id': org['id'],
                    'new-name': test_data['name'],
                })
                # Fetch the org again
                org = Org.info({'id': org['id']})
                self.assertEqual(org['name'], test_data['name'])
コード例 #15
0
    def test_positive_update_description(self):
        """Create organization with valid values then update its description

        @id: c5cb0d68-10dd-48ee-8d56-83be8b33d729

        @assert: organization description is updated
        """
        for new_desc in valid_data_list():
            with self.subTest(new_desc):
                org = make_org()
                # Update the org name
                Org.update({
                    'description': new_desc,
                    'id': org['id'],
                })
                # Fetch the org again
                org = Org.info({'id': org['id']})
                self.assertEqual(org['description'], new_desc)
コード例 #16
0
    def test_positive_update_description(self):
        """@test: Create organization with valid values then update its
        description

        @feature: Organization

        @assert: organization description is updated
        """
        for test_data in positive_desc_data():
            with self.subTest(test_data):
                org = make_org()
                # Update the org name
                Org.update({
                    'description': test_data['description'],
                    'id': org['id'],
                })
                # Fetch the org again
                org = Org.info({'id': org['id']})
                self.assertEqual(org['description'], test_data['description'])
コード例 #17
0
    def test_positive_update_description(self):
        """Create organization with valid values then update its description

        :id: c5cb0d68-10dd-48ee-8d56-83be8b33d729

        :expectedresults: organization description is updated

        :CaseImportance: Critical
        """
        for new_desc in valid_data_list():
            with self.subTest(new_desc):
                org = make_org()
                # Update the org name
                Org.update({
                    'description': new_desc,
                    'id': org['id'],
                })
                # Fetch the org again
                org = Org.info({'id': org['id']})
                self.assertEqual(org['description'], new_desc)
コード例 #18
0
    def test_positive_update_name(self):
        """Create organization with valid values then update its name

        :id: 66581003-f5d9-443c-8cd6-00f68087e8e9

        :expectedresults: organization name is updated

        :CaseImportance: Critical
        """
        for new_name in valid_org_names_list():
            with self.subTest(new_name):
                org = make_org()
                # Update the org name
                Org.update({
                    'id': org['id'],
                    'new-name': new_name,
                })
                # Fetch the org again
                org = Org.info({'id': org['id']})
                self.assertEqual(org['name'], new_name)
コード例 #19
0
    def test_positive_update_name_description(self):
        """Create organization with valid values then update its name and
        description

        @feature: Organization

        @assert: organization name and description are updated
        """
        for new_name, new_desc in zip(
                valid_org_names_list(), valid_data_list()):
            with self.subTest(new_name + new_desc):
                org = make_org()
                # Update the org name
                Org.update({
                    'description': new_desc,
                    'id': org['id'],
                    'new-name': new_name,
                })
                # Fetch the org again
                org = Org.info({'id': org['id']})
                self.assertEqual(org['description'], new_desc)
                self.assertEqual(org['name'], new_name)
コード例 #20
0
def test_positive_update(module_org):
    """Update organization name and description

    :id: 66581003-f5d9-443c-8cd6-00f68087e8e9

    :expectedresults: organization name is updated

    :CaseImportance: Critical
    """

    new_name = valid_org_names_list()[0]
    new_desc = list(valid_data_list().values())[0]

    # upgrade name
    Org.update({'id': module_org.id, 'new-name': new_name})
    org = Org.info({'id': module_org.id})
    assert org['name'] == new_name

    # upgrade description
    Org.update({'description': new_desc, 'id': org['id']})
    org = Org.info({'id': org['id']})
    assert org['description'] == new_desc
コード例 #21
0
    def test_positive_update_name_description(self):
        """Create organization with valid values then update its name and
        description

        @id: 42635526-fb10-4811-8fe7-1d4c218a056e

        @assert: organization name and description are updated
        """
        for new_name, new_desc in zip(
                valid_org_names_list(), valid_data_list()):
            with self.subTest(new_name + new_desc):
                org = make_org()
                # Update the org name
                Org.update({
                    'description': new_desc,
                    'id': org['id'],
                    'new-name': new_name,
                })
                # Fetch the org again
                org = Org.info({'id': org['id']})
                self.assertEqual(org['description'], new_desc)
                self.assertEqual(org['name'], new_name)
コード例 #22
0
    def test_positive_update_name_description(self):
        """Create organization with valid values then update its name and
        description

        :id: 42635526-fb10-4811-8fe7-1d4c218a056e

        :expectedresults: organization name and description are updated

        :CaseImportance: Critical
        """
        for new_name, new_desc in zip(
                valid_org_names_list(), valid_data_list()):
            with self.subTest(new_name + new_desc):
                org = make_org()
                # Update the org name
                Org.update({
                    'description': new_desc,
                    'id': org['id'],
                    'new-name': new_name,
                })
                # Fetch the org again
                org = Org.info({'id': org['id']})
                self.assertEqual(org['description'], new_desc)
                self.assertEqual(org['name'], new_name)
コード例 #23
0
ssh.upload_file('/home/chozhang/Documents/satellite6/20150526-10k-RHEL-Manifest.zip','test_manifest.zip')
start = time.time()
result = Subscription.upload({
  'file':'./test_manifest.zip',
  'organization-id':'1'
})

if result.return_code != 0:
  print "Failed to upload manifest: {0} and return code: {1}" \
	.format(result.stderr, result.return_code)
else:
   # print subscription list
   result = Subscription.list({'organization-id':'1'}, per_page=False)
   if result.return_code == 0:
      print "Subscription name: ",result.stdout[0]['name']
      print "Subscription id: ",result.stdout[0]['id'] 
      print "Upload successful!"
   else:
      print "Failed to list subscriptions: {0} and return code: {1}".format(result.stderr, result.return_code)
     

end = time.time()
print 'real','   ',end-start,'s'

from robottelo.cli.org import Org
# update organization id
Org.update({'id':'1', 'redhat-repository-url':'http://172.16.20.12/pub'})
result = Org.info({'id':'1'})
if result.return_code == 0:
   print "Organization CDN URL: ",result.stdout['red-hat-repository-url']