1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

removing old, duplicated tests

This commit is contained in:
Wayne Witzel III 2016-06-06 11:39:48 -04:00
parent 3c887768c1
commit 1b37818eba
3 changed files with 0 additions and 22265 deletions

File diff suppressed because it is too large Load Diff

View File

@ -938,31 +938,6 @@ class InventoryImportTest(BaseCommandMixin, BaseLiveServerTest):
self.assertNotEqual(new_inv.total_groups, 0) self.assertNotEqual(new_inv.total_groups, 0)
self.assertElapsedLessThan(60) self.assertElapsedLessThan(60)
@unittest.skipIf(True,
'This test is deprecated and being removed from '
'integration and unit tests in favor of writing '
'an explicit unit test around what the original '
'problem was')
def test_splunk_inventory(self):
new_inv = self.organizations[0].inventories.create(name='splunk')
self.assertEqual(new_inv.hosts.count(), 0)
self.assertEqual(new_inv.groups.count(), 0)
inv_file = os.path.join(os.path.dirname(__file__), '..', '..', 'data',
'splunk_inventory.py')
result, stdout, stderr = self.run_command('inventory_import',
inventory_id=new_inv.pk,
source=inv_file, verbosity=0)
self.assertEqual(result, None, stdout + stderr)
# Check that inventory is populated as expected within a reasonable
# amount of time. Computed fields should also be updated.
new_inv = Inventory.objects.get(pk=new_inv.pk)
self.assertNotEqual(new_inv.hosts.count(), 0)
self.assertNotEqual(new_inv.groups.count(), 0)
self.assertNotEqual(new_inv.total_hosts, 0)
self.assertNotEqual(new_inv.total_groups, 0)
self.assertElapsedLessThan(600)
def _get_ngroups_for_nhosts(self, n): def _get_ngroups_for_nhosts(self, n):
if n > 0: if n > 0:
return min(n, 10) + ((n - 1) / 10 + 1) + ((n - 1) / 100 + 1) + ((n - 1) / 1000 + 1) return min(n, 10) + ((n - 1) / 10 + 1) + ((n - 1) / 100 + 1) + ((n - 1) / 1000 + 1)

View File

@ -1424,80 +1424,6 @@ class InventoryUpdatesTest(BaseTransactionTest):
response = self.put(inv_src_url2, inv_src_data, expect=200) response = self.put(inv_src_url2, inv_src_data, expect=200)
self.assertEqual(response['source_regions'], 'ORD,IAD') self.assertEqual(response['source_regions'], 'ORD,IAD')
def test_post_inventory_source_update(self):
creds_url = reverse('api:credential_list')
inv_src_url = reverse('api:inventory_source_detail',
args=(self.group.inventory_source.pk,))
inv_src_update_url = reverse('api:inventory_source_update_view',
args=(self.group.inventory_source.pk,))
# Create a credential to use for this inventory source.
aws_cred_data = {
'name': 'AWS key that does not need to have valid info because we '
'do not care if the update actually succeeds',
'kind': 'aws',
'user': self.super_django_user.pk,
'username': 'aws access key id goes here',
'password': 'aws secret access key goes here',
}
with self.current_user(self.super_django_user):
aws_cred_response = self.post(creds_url, aws_cred_data, expect=201)
aws_cred_id = aws_cred_response['id']
# Updaate the inventory source to use EC2.
inv_src_data = {
'source': 'ec2',
'credential': aws_cred_id,
}
with self.current_user(self.super_django_user):
self.put(inv_src_url, inv_src_data, expect=200)
# Read the inventory source, verify the update URL returns can_update.
with self.current_user(self.super_django_user):
self.get(inv_src_url, expect=200)
response = self.get(inv_src_update_url, expect=200)
self.assertTrue(response['can_update'])
# Now do the update.
with self.current_user(self.super_django_user):
self.post(inv_src_update_url, {}, expect=202)
# Normal user should be allowed as an org admin.
with self.current_user(self.normal_django_user):
self.get(inv_src_url, expect=200)
response = self.get(inv_src_update_url, expect=200)
self.assertTrue(response['can_update'])
with self.current_user(self.normal_django_user):
self.post(inv_src_update_url, {}, expect=202)
# Other user should be denied as only an org user.
with self.current_user(self.other_django_user):
self.get(inv_src_url, expect=403)
response = self.get(inv_src_update_url, expect=403)
with self.current_user(self.other_django_user):
self.post(inv_src_update_url, {}, expect=403)
# If given read permission to the inventory, other user should be able
# to see the inventory source and update view, but not start an update.
user_roles_list_url = reverse('api:user_roles_list', args=(self.other_django_user.pk,))
with self.current_user(self.super_django_user):
self.post(user_roles_list_url, {"id": self.inventory.read_role.id}, expect=204)
with self.current_user(self.other_django_user):
self.get(inv_src_url, expect=200)
response = self.get(inv_src_update_url, expect=200)
with self.current_user(self.other_django_user):
self.post(inv_src_update_url, {}, expect=403)
# Once given write permission, the normal user is able to update the
# inventory source.
with self.current_user(self.super_django_user):
self.post(user_roles_list_url, {"id": self.inventory.admin_role.id}, expect=204)
with self.current_user(self.other_django_user):
self.get(inv_src_url, expect=200)
response = self.get(inv_src_update_url, expect=200)
# FIXME: This is misleading, as an update would fail...
self.assertTrue(response['can_update'])
with self.current_user(self.other_django_user):
self.post(inv_src_update_url, {}, expect=202)
# Nobody user should be denied as well.
with self.current_user(self.nobody_django_user):
self.get(inv_src_url, expect=403)
response = self.get(inv_src_update_url, expect=403)
with self.current_user(self.nobody_django_user):
self.post(inv_src_update_url, {}, expect=403)
def test_update_from_ec2(self): def test_update_from_ec2(self):
source_username = getattr(settings, 'TEST_AWS_ACCESS_KEY_ID', '') source_username = getattr(settings, 'TEST_AWS_ACCESS_KEY_ID', '')
source_password = getattr(settings, 'TEST_AWS_SECRET_ACCESS_KEY', '') source_password = getattr(settings, 'TEST_AWS_SECRET_ACCESS_KEY', '')