def test_manifest_history(self): """@Test: upload manifest (positive) and check history @Feature: Subscriptions/Manifest History @Assert: Manifest history is shown properly """ self._upload_manifest(self.manifest, self.org['id']) result = Subscription.list( {'organization-id': self.org['id']}, per_page=None ) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) result = Subscription.manifest_history({ 'organization-id': self.org['id'], }) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) self.assertIn( '{0} file imported successfully.'.format(self.org['name']), ''.join(result.stdout) )
def test_positive_manifest_history(function_org, manifest_clone_upload): """upload manifest and check history :id: 000ab0a0-ec1b-497a-84ff-3969a965b52c :expectedresults: Manifest history is shown properly :CaseImportance: Medium """ Subscription.list({'organization-id': function_org.id}, per_page=None) history = Subscription.manifest_history({'organization-id': function_org.id}) assert f'{function_org.name} file imported successfully.' in ''.join(history)
def test_positive_manifest_history(self): """upload manifest and check history :id: 000ab0a0-ec1b-497a-84ff-3969a965b52c :expectedresults: Manifest history is shown properly :CaseImportance: Medium """ self._upload_manifest(self.org['id']) Subscription.list({'organization-id': self.org['id']}, per_page=None) history = Subscription.manifest_history({'organization-id': self.org['id']}) self.assertIn('{0} file imported successfully.'.format(self.org['name']), ''.join(history))
def test_import_orgs_manifests(self, test_data): """@test: Import all organizations from the default data set (predefined source) and upload manifests for each of them @feature: Import Organizations including Manifests @assert: 3 Organizations are created with 3 manifests uploaded """ files = dict(self.default_dataset[1]) files['users'] = update_csv_values( files['users'], u'organization_id', test_data, self.default_dataset[0] ) csv_records = csv_to_dataset([files['users']]) # create number of manifests corresponding to the number of orgs manifest_list = [] man_dir = ssh.command( u'mktemp -d -p {}'.format(self.default_dataset[0]) ).stdout[0] for org in set([rec['organization'] for rec in csv_records]): for char in [' ', '.', '#']: org = org.replace(char, '_') man_file = manifests.clone() ssh.upload_file(man_file, u'{0}/{1}.zip'.format(man_dir, org)) manifest_list.append(u'{0}/{1}.zip'.format(man_dir, org)) os.remove(man_file) ssh_import = Import.organization({ 'csv-file': files['users'], 'upload-manifests-from': man_dir, }) # now to check whether the orgs from csv appeared in satellite orgs = set(org['name'] for org in Org.list().stdout) imp_orgs = set( org['organization'] for org in csv_to_dataset([files['users']]) ) self.assertEqual(ssh_import.return_code, 0) self.assertTrue(imp_orgs.issubset(orgs)) for org in imp_orgs: manifest_history = Subscription.manifest_history( {'organization': org} ).stdout[3] self.assertIn('SUCCESS', manifest_history)
def test_positive_manifest_history(self): """upload manifest and check history @Feature: Subscriptions/Manifest History @Assert: Manifest history is shown properly """ self._upload_manifest(self.org['id']) Subscription.list( {'organization-id': self.org['id']}, per_page=None, ) history = Subscription.manifest_history({ 'organization-id': self.org['id'], }) self.assertIn( '{0} file imported successfully.'.format(self.org['name']), ''.join(history), )
def test_positive_manifest_history(self): """upload manifest and check history @id: 000ab0a0-ec1b-497a-84ff-3969a965b52c @Assert: Manifest history is shown properly """ self._upload_manifest(self.org['id']) Subscription.list( {'organization-id': self.org['id']}, per_page=None, ) history = Subscription.manifest_history({ 'organization-id': self.org['id'], }) self.assertIn( '{0} file imported successfully.'.format(self.org['name']), ''.join(history), )
def test_manifest_history(self): """@Test: upload manifest (positive) and check history @Feature: Subscriptions/Manifest History @Assert: Manifest history is shown properly """ upload_file(self.manifest, remote_file=self.manifest) result = Subscription.upload({ 'file': self.manifest, 'organization-id': self.org['id'], }) self.assertEqual(result.return_code, 0, "return code must be 0, instead got {0}" ''.format(result.return_code)) self.assertEqual( len(result.stderr), 0, "There should not be an exception while uploading manifest.") result = Subscription.list( {'organization-id': self.org['id']}, per_page=None) self.assertEqual(result.return_code, 0, "return code must be 0, instead got {0}" ''.format(result.return_code)) self.assertEqual( len(result.stderr), 0, "There should not be an exception while listing the manifest.") self.assertGreater(len(result.stdout), 0) result = Subscription.manifest_history({ 'organization-id': self.org['id'], }) self.assertEqual(result.return_code, 0, "return code must be 0, instead got {0}" ''.format(result.return_code)) self.assertEqual( len(result.stderr), 0, "There should not be an exception for manifest history.") self.assertIn('{0} file imported successfully.' ''.format(self.org['name']), ''.join(result.stdout))
def test_manifest_history(self): """@Test: upload manifest (positive) and check history @Feature: Subscriptions/Manifest History @Assert: Manifest history is shown properly """ upload_file(self.manifest, remote_file=self.manifest) result = Subscription.upload({ 'file': self.manifest, 'organization-id': self.org['id'], }) self.assertEqual(result.return_code, 0, "return code must be 0, instead got {0}" ''.format(result.return_code)) self.assertEqual( len(result.stderr), 0, "There should not be an exception while uploading manifest.") result = Subscription.list( {'organization-id': self.org['id']}, per_page=None) self.assertEqual(result.return_code, 0, "return code must be 0, instead got {0}" ''.format(result.return_code)) self.assertEqual( len(result.stderr), 0, "There should not be an exception while listing the manifest.") self.assertGreater(len(result.stdout), 0) result = Subscription.manifest_history({ 'organization-id': self.org['id'], }) self.assertEqual(result.return_code, 0, "return code must be 0, instead got {0}" ''.format(result.return_code)) self.assertEqual( len(result.stderr), 0, "There should not be an exception for manifest history.") self.assertIn('{0} file imported successfully.' ''.format(self.org['name']), ''.join(result.stdout))
def test_positive_manifest_history(self): """upload manifest and check history @Feature: Subscriptions/Manifest History @Assert: Manifest history is shown properly """ self._upload_manifest(self.org['id']) Subscription.list( {'organization-id': self.org['id']}, per_page=None, ) history = Subscription.manifest_history({ 'organization-id': self.org['id'], }) self.assertIn( '{0} file imported successfully.'.format(self.org['name']), ''.join(history), )