follow up and finish option request test

This commit is contained in:
Chris Meyers
2016-03-01 17:28:26 -05:00
parent 88865a2203
commit 4fc7fea2b8

View File

@@ -72,28 +72,21 @@ def test_basic_fields(hosts, fact_scans, get, user):
@mock.patch('awx.api.views.feature_enabled', new=mock_feature_enabled) @mock.patch('awx.api.views.feature_enabled', new=mock_feature_enabled)
@pytest.mark.django_db @pytest.mark.django_db
@pytest.mark.skipif(True, reason="Options fix landed in devel but not here. Enable this after this pr gets merged.")
def test_basic_options_fields(hosts, fact_scans, options, user): def test_basic_options_fields(hosts, fact_scans, options, user):
hosts = hosts(host_count=1) hosts = hosts(host_count=1)
fact_scans(fact_scans=1) fact_scans(fact_scans=1)
url = reverse('api:host_fact_versions_list', args=(hosts[0].pk,)) url = reverse('api:host_fact_versions_list', args=(hosts[0].pk,))
response = options(url, user('admin', True), pk=hosts[0].id) response = options(url, None, user('admin', True), pk=hosts[0].id)
#import json import json
#print(json.dumps(response.data)) print(json.dumps(response.data))
assert 'related' in response.data
assert 'id' in response.data assert 'related' in response.data['actions']['GET']
assert 'facts' in response.data assert 'module' in response.data['actions']['GET']
assert 'module' in response.data assert ("ansible", "Ansible") in response.data['actions']['GET']['module']['choices']
assert 'host' in response.data assert ("services", "Services") in response.data['actions']['GET']['module']['choices']
assert isinstance(response.data['host'], int) assert ("packages", "Packages") in response.data['actions']['GET']['module']['choices']
assert 'summary_fields' in response.data
assert 'host' in response.data['summary_fields']
assert 'name' in response.data['summary_fields']['host']
assert 'description' in response.data['summary_fields']['host']
assert 'host' in response.data['related']
assert reverse('api:host_detail', args=(hosts[0].pk,)) == response.data['related']['host']
@mock.patch('awx.api.views.feature_enabled', new=mock_feature_enabled) @mock.patch('awx.api.views.feature_enabled', new=mock_feature_enabled)
@pytest.mark.django_db @pytest.mark.django_db