mockdata

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2021 License: MIT Imports: 0 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MockedListGroupsResponse mocked `ListGroups` endpoint response
	MockedListGroupsResponse = []byte(`
    {
        "count": 12,
        "next": null,
        "previous": null,
        "results": [
            {
                "id": 21,
                "type": "group",
                "url": "/api/v2/groups/21/",
                "related": {
                    "created_by": "/api/v2/users/11/",
                    "job_host_summaries": "/api/v2/groups/21/job_host_summaries/",
                    "variable_data": "/api/v2/groups/21/variable_data/",
                    "job_events": "/api/v2/groups/21/job_events/",
                    "potential_children": "/api/v2/groups/21/potential_children/",
                    "ad_hoc_commands": "/api/v2/groups/21/ad_hoc_commands/",
                    "all_hosts": "/api/v2/groups/21/all_hosts/",
                    "activity_stream": "/api/v2/groups/21/activity_stream/",
                    "hosts": "/api/v2/groups/21/hosts/",
                    "children": "/api/v2/groups/21/children/",
                    "inventory_sources": "/api/v2/groups/21/inventory_sources/",
                    "inventory": "/api/v2/inventories/9/"
                },
                "summary_fields": {
                    "inventory": {
                        "id": 9,
                        "name": "test",
                        "description": "",
                        "has_active_failures": false,
                        "total_hosts": 8,
                        "hosts_with_active_failures": 0,
                        "total_groups": 4,
                        "groups_with_active_failures": 0,
                        "has_inventory_sources": false,
                        "total_inventory_sources": 0,
                        "inventory_sources_with_failures": 0,
                        "organization_id": 16,
                        "kind": ""
                    },
                    "created_by": {
                        "id": 11,
                        "username": "demouser",
                        "first_name": "Demo",
                        "last_name": "User"
                    },
                    "user_capabilities": {
                        "edit": true,
                        "copy": true,
                        "delete": true
                    }
                },
                "created": "2018-07-17T13:27:46.686176Z",
                "modified": "2018-07-17T13:28:07.127040Z",
                "name": "Demo Group",
                "description": "",
                "inventory": 9,
                "variables": "",
                "has_active_failures": false,
                "total_hosts": 3,
                "hosts_with_active_failures": 0,
                "total_groups": 0,
                "groups_with_active_failures": 0,
                "has_inventory_sources": false
            }
        ]
    }`)

	// MockedCreateGroupResponse mocked `CreateGroup` endpoint response
	MockedCreateGroupResponse = []byte(`
    {
        "id": 21,
        "type": "group",
        "url": "/api/v2/groups/21/",
        "related": {
            "created_by": "/api/v2/users/11/",
            "job_host_summaries": "/api/v2/groups/21/job_host_summaries/",
            "variable_data": "/api/v2/groups/21/variable_data/",
            "job_events": "/api/v2/groups/21/job_events/",
            "potential_children": "/api/v2/groups/21/potential_children/",
            "ad_hoc_commands": "/api/v2/groups/21/ad_hoc_commands/",
            "all_hosts": "/api/v2/groups/21/all_hosts/",
            "activity_stream": "/api/v2/groups/21/activity_stream/",
            "hosts": "/api/v2/groups/21/hosts/",
            "children": "/api/v2/groups/21/children/",
            "inventory_sources": "/api/v2/groups/21/inventory_sources/",
            "inventory": "/api/v2/inventories/9/"
        },
        "summary_fields": {
            "inventory": {
                "id": 9,
                "name": "test",
                "description": "",
                "has_active_failures": false,
                "total_hosts": 8,
                "hosts_with_active_failures": 0,
                "total_groups": 4,
                "groups_with_active_failures": 0,
                "has_inventory_sources": false,
                "total_inventory_sources": 0,
                "inventory_sources_with_failures": 0,
                "organization_id": 16,
                "kind": ""
            },
            "created_by": {
                "id": 11,
                "username": "demouser",
                "first_name": "Demo",
                "last_name": "User"
            },
            "user_capabilities": {
                "edit": true,
                "copy": true,
                "delete": true
            }
        },
        "created": "2018-07-17T13:27:46.686176Z",
        "modified": "2018-07-17T13:28:07.127040Z",
        "name": "Demo Group",
        "description": "",
        "inventory": 9,
        "variables": "",
        "has_active_failures": false,
        "total_hosts": 3,
        "hosts_with_active_failures": 0,
        "total_groups": 0,
        "groups_with_active_failures": 0,
        "has_inventory_sources": false
    }`)

	// MockedUpdateGroupResponse mocked `UpdateGroup` endpoint response
	MockedUpdateGroupResponse = []byte(`
    {
        "id": 21,
        "type": "group",
        "url": "/api/v2/groups/21/",
        "related": {
            "created_by": "/api/v2/users/11/",
            "job_host_summaries": "/api/v2/groups/21/job_host_summaries/",
            "variable_data": "/api/v2/groups/21/variable_data/",
            "job_events": "/api/v2/groups/21/job_events/",
            "potential_children": "/api/v2/groups/21/potential_children/",
            "ad_hoc_commands": "/api/v2/groups/21/ad_hoc_commands/",
            "all_hosts": "/api/v2/groups/21/all_hosts/",
            "activity_stream": "/api/v2/groups/21/activity_stream/",
            "hosts": "/api/v2/groups/21/hosts/",
            "children": "/api/v2/groups/21/children/",
            "inventory_sources": "/api/v2/groups/21/inventory_sources/",
            "inventory": "/api/v2/inventories/9/"
        },
        "summary_fields": {
            "inventory": {
                "id": 9,
                "name": "test",
                "description": "",
                "has_active_failures": false,
                "total_hosts": 8,
                "hosts_with_active_failures": 0,
                "total_groups": 4,
                "groups_with_active_failures": 0,
                "has_inventory_sources": false,
                "total_inventory_sources": 0,
                "inventory_sources_with_failures": 0,
                "organization_id": 16,
                "kind": ""
            },
            "created_by": {
                "id": 11,
                "username": "demouser",
                "first_name": "Demo",
                "last_name": "User"
            },
            "user_capabilities": {
                "edit": true,
                "copy": true,
                "delete": true
            }
        },
        "created": "2018-07-17T13:27:46.686176Z",
        "modified": "2018-07-17T13:28:07.127040Z",
        "name": "Demo Group",
        "description": "Add description",
        "inventory": 9,
        "variables": "",
        "has_active_failures": false,
        "total_hosts": 3,
        "hosts_with_active_failures": 0,
        "total_groups": 0,
        "groups_with_active_failures": 0,
        "has_inventory_sources": false
    }`)

	// MockedDeleteGroupResponse mocked `DeleteGroup` endpoint response
	MockedDeleteGroupResponse = []byte(`{}`)
)
View Source
var (
	// MockedListHostsResponse mocked `ListHosts` endpoint response
	MockedListHostsResponse = []byte(`
        {
            "count": 1,
            "next": null,
            "previous": null,
            "results": [
                {
                    "id": 1,
                    "type": "host",
                    "url": "/api/v2/hosts/1/",
                    "related": {
                        "created_by": "/api/v2/users/2/",
                        "modified_by": "/api/v2/users/2/",
                        "job_host_summaries": "/api/v2/hosts/1/job_host_summaries/",
                        "variable_data": "/api/v2/hosts/1/variable_data/",
                        "job_events": "/api/v2/hosts/1/job_events/",
                        "ad_hoc_commands": "/api/v2/hosts/1/ad_hoc_commands/",
                        "inventory_sources": "/api/v2/hosts/1/inventory_sources/",
                        "fact_versions": "/api/v2/hosts/1/fact_versions/",
                        "smart_inventories": "/api/v2/hosts/1/smart_inventories/",
                        "groups": "/api/v2/hosts/1/groups/",
                        "activity_stream": "/api/v2/hosts/1/activity_stream/",
                        "all_groups": "/api/v2/hosts/1/all_groups/",
                        "ad_hoc_command_events": "/api/v2/hosts/1/ad_hoc_command_events/",
                        "insights": "/api/v2/hosts/1/insights/",
                        "inventory": "/api/v2/inventories/1/",
                        "ansible_facts": "/api/v2/hosts/1/ansible_facts/"
                    },
                    "summary_fields": {
                        "inventory": {
                            "id": 1,
                            "name": "Demo Inventory",
                            "description": "",
                            "has_active_failures": false,
                            "total_hosts": 1,
                            "hosts_with_active_failures": 0,
                            "total_groups": 2,
                            "groups_with_active_failures": 0,
                            "has_inventory_sources": false,
                            "total_inventory_sources": 0,
                            "inventory_sources_with_failures": 0,
                            "organization_id": 1,
                            "kind": ""
                        },
                        "created_by": {
                            "id": 2,
                            "username": "admin",
                            "first_name": "",
                            "last_name": ""
                        },
                        "modified_by": {
                            "id": 2,
                            "username": "admin",
                            "first_name": "",
                            "last_name": ""
                        },
                        "user_capabilities": {
                            "edit": true,
                            "delete": true
                        },
                        "groups": {
                            "count": 2,
                            "results": [
                                {
                                    "id": 19,
                                    "name": "ciao"
                                },
                                {
                                    "id": 21,
                                    "name": "test"
                                }
                            ]
                        },
                        "recent_jobs": []
                    },
                    "created": "2018-08-27T13:47:11.145028Z",
                    "modified": "2018-08-27T13:47:11.145042Z",
                    "name": "localhost",
                    "description": "",
                    "inventory": 1,
                    "enabled": true,
                    "instance_id": "",
                    "variables": "ansible_connection: local",
                    "has_active_failures": false,
                    "has_inventory_sources": false,
                    "last_job": null,
                    "last_job_host_summary": null,
                    "insights_system_id": null,
                    "ansible_facts_modified": null
                }
            ]
        }`)

	// MockedCreateHostResponse mocked `CreateHost` endpoint response
	MockedCreateHostResponse = []byte(`
        {
            "id": 3,
            "type": "host",
            "url": "/api/v2/hosts/3/",
            "related": {
                "named_url": "/api/v2/hosts/test++Demo Inventory++Default/",
                "created_by": "/api/v2/users/2/",
                "modified_by": "/api/v2/users/2/",
                "job_host_summaries": "/api/v2/hosts/3/job_host_summaries/",
                "variable_data": "/api/v2/hosts/3/variable_data/",
                "job_events": "/api/v2/hosts/3/job_events/",
                "ad_hoc_commands": "/api/v2/hosts/3/ad_hoc_commands/",
                "inventory_sources": "/api/v2/hosts/3/inventory_sources/",
                "fact_versions": "/api/v2/hosts/3/fact_versions/",
                "smart_inventories": "/api/v2/hosts/3/smart_inventories/",
                "groups": "/api/v2/hosts/3/groups/",
                "activity_stream": "/api/v2/hosts/3/activity_stream/",
                "all_groups": "/api/v2/hosts/3/all_groups/",
                "ad_hoc_command_events": "/api/v2/hosts/3/ad_hoc_command_events/",
                "insights": "/api/v2/hosts/3/insights/",
                "inventory": "/api/v2/inventories/1/",
                "ansible_facts": "/api/v2/hosts/3/ansible_facts/"
            },
            "summary_fields": {
                "inventory": {
                    "id": 1,
                    "name": "Demo Inventory",
                    "description": "",
                    "has_active_failures": false,
                    "total_hosts": 1,
                    "hosts_with_active_failures": 0,
                    "total_groups": 3,
                    "groups_with_active_failures": 0,
                    "has_inventory_sources": false,
                    "total_inventory_sources": 0,
                    "inventory_sources_with_failures": 0,
                    "organization_id": 1,
                    "kind": ""
                },
                "created_by": {
                    "id": 2,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "modified_by": {
                    "id": 2,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "user_capabilities": {
                    "edit": true,
                    "delete": true
                },
                "groups": {
                    "count": 0,
                    "results": []
                },
                "recent_jobs": []
            },
            "created": "2018-09-01T11:18:16.456501Z",
            "modified": "2018-09-01T11:18:16.456512Z",
            "name": "test",
            "description": "test create host",
            "inventory": 1,
            "enabled": true,
            "instance_id": "",
            "variables": "ansible_host: localhost",
            "has_active_failures": false,
            "has_inventory_sources": false,
            "last_job": null,
            "last_job_host_summary": null,
            "insights_system_id": null,
            "ansible_facts_modified": null
        }`)

	// MockedUpdateHostResponse mocked `UpdateHost` endpoint response
	MockedUpdateHostResponse = []byte(`
        {
            "id": 3,
            "type": "host",
            "url": "/api/v2/hosts/3/",
            "related": {
                "named_url": "/api/v2/hosts/testUpdate++Demo Inventory++Default/",
                "created_by": "/api/v2/users/2/",
                "modified_by": "/api/v2/users/2/",
                "job_host_summaries": "/api/v2/hosts/3/job_host_summaries/",
                "variable_data": "/api/v2/hosts/3/variable_data/",
                "job_events": "/api/v2/hosts/3/job_events/",
                "ad_hoc_commands": "/api/v2/hosts/3/ad_hoc_commands/",
                "inventory_sources": "/api/v2/hosts/3/inventory_sources/",
                "fact_versions": "/api/v2/hosts/3/fact_versions/",
                "smart_inventories": "/api/v2/hosts/3/smart_inventories/",
                "groups": "/api/v2/hosts/3/groups/",
                "activity_stream": "/api/v2/hosts/3/activity_stream/",
                "all_groups": "/api/v2/hosts/3/all_groups/",
                "ad_hoc_command_events": "/api/v2/hosts/3/ad_hoc_command_events/",
                "insights": "/api/v2/hosts/3/insights/",
                "inventory": "/api/v2/inventories/1/",
                "ansible_facts": "/api/v2/hosts/3/ansible_facts/"
            },
            "summary_fields": {
                "inventory": {
                    "id": 1,
                    "name": "Demo Inventory",
                    "description": "",
                    "has_active_failures": false,
                    "total_hosts": 1,
                    "hosts_with_active_failures": 0,
                    "total_groups": 3,
                    "groups_with_active_failures": 0,
                    "has_inventory_sources": false,
                    "total_inventory_sources": 0,
                    "inventory_sources_with_failures": 0,
                    "organization_id": 1,
                    "kind": ""
                },
                "created_by": {
                    "id": 2,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "modified_by": {
                    "id": 2,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "user_capabilities": {
                    "edit": true,
                    "delete": true
                },
                "groups": {
                    "count": 0,
                    "results": []
                },
                "recent_jobs": []
            },
            "created": "2018-09-01T11:18:16.456501Z",
            "modified": "2018-09-01T11:18:16.456512Z",
            "name": "testUpdate",
            "description": "test create host",
            "inventory": 1,
            "enabled": true,
            "instance_id": "",
            "variables": "ansible_host: localhost",
            "has_active_failures": false,
            "has_inventory_sources": false,
            "last_job": null,
            "last_job_host_summary": null,
            "insights_system_id": null,
            "ansible_facts_modified": null
        }`)

	// MockedAssociateGroupResponse mocked `AssociateGroup` endpoint response
	MockedAssociateGroupResponse = []byte(`
        {
            "id": 3,
            "type": "host",
            "url": "/api/v2/hosts/3/",
            "related": {
                "named_url": "/api/v2/hosts/testUpdate++Demo Inventory++Default/",
                "created_by": "/api/v2/users/2/",
                "modified_by": "/api/v2/users/2/",
                "job_host_summaries": "/api/v2/hosts/3/job_host_summaries/",
                "variable_data": "/api/v2/hosts/3/variable_data/",
                "job_events": "/api/v2/hosts/3/job_events/",
                "ad_hoc_commands": "/api/v2/hosts/3/ad_hoc_commands/",
                "inventory_sources": "/api/v2/hosts/3/inventory_sources/",
                "fact_versions": "/api/v2/hosts/3/fact_versions/",
                "smart_inventories": "/api/v2/hosts/3/smart_inventories/",
                "groups": "/api/v2/hosts/3/groups/",
                "activity_stream": "/api/v2/hosts/3/activity_stream/",
                "all_groups": "/api/v2/hosts/3/all_groups/",
                "ad_hoc_command_events": "/api/v2/hosts/3/ad_hoc_command_events/",
                "insights": "/api/v2/hosts/3/insights/",
                "inventory": "/api/v2/inventories/1/",
                "ansible_facts": "/api/v2/hosts/3/ansible_facts/"
            },
            "summary_fields": {
                "inventory": {
                    "id": 1,
                    "name": "Demo Inventory",
                    "description": "",
                    "has_active_failures": false,
                    "total_hosts": 1,
                    "hosts_with_active_failures": 0,
                    "total_groups": 3,
                    "groups_with_active_failures": 0,
                    "has_inventory_sources": false,
                    "total_inventory_sources": 0,
                    "inventory_sources_with_failures": 0,
                    "organization_id": 1,
                    "kind": ""
                },
                "created_by": {
                    "id": 2,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "modified_by": {
                    "id": 2,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "user_capabilities": {
                    "edit": true,
                    "delete": true
                },
                "groups": {
                    "count": 1,
                    "results": [
                        { "id": 10,
                          "name": "testGroup"
                        }
                    ]
                },
                "recent_jobs": []
            },
            "created": "2018-09-01T11:18:16.456501Z",
            "modified": "2018-09-01T11:18:16.456512Z",
            "name": "testUpdate",
            "description": "test create host",
            "inventory": 1,
            "enabled": true,
            "instance_id": "",
            "variables": "ansible_host: localhost",
            "has_active_failures": false,
            "has_inventory_sources": false,
            "last_job": null,
            "last_job_host_summary": null,
            "insights_system_id": null,
            "ansible_facts_modified": null
        }`)

	// MockedDisAssociateGroupResponse mocked `DisAssociateGroup` endpoint response
	MockedDisAssociateGroupResponse = []byte(`
    {
        "id": 3,
        "type": "host",
        "url": "/api/v2/hosts/3/",
        "related": {
            "named_url": "/api/v2/hosts/testUpdate++Demo Inventory++Default/",
            "created_by": "/api/v2/users/2/",
            "modified_by": "/api/v2/users/2/",
            "job_host_summaries": "/api/v2/hosts/3/job_host_summaries/",
            "variable_data": "/api/v2/hosts/3/variable_data/",
            "job_events": "/api/v2/hosts/3/job_events/",
            "ad_hoc_commands": "/api/v2/hosts/3/ad_hoc_commands/",
            "inventory_sources": "/api/v2/hosts/3/inventory_sources/",
            "fact_versions": "/api/v2/hosts/3/fact_versions/",
            "smart_inventories": "/api/v2/hosts/3/smart_inventories/",
            "groups": "/api/v2/hosts/3/groups/",
            "activity_stream": "/api/v2/hosts/3/activity_stream/",
            "all_groups": "/api/v2/hosts/3/all_groups/",
            "ad_hoc_command_events": "/api/v2/hosts/3/ad_hoc_command_events/",
            "insights": "/api/v2/hosts/3/insights/",
            "inventory": "/api/v2/inventories/1/",
            "ansible_facts": "/api/v2/hosts/3/ansible_facts/"
        },
        "summary_fields": {
            "inventory": {
                "id": 1,
                "name": "Demo Inventory",
                "description": "",
                "has_active_failures": false,
                "total_hosts": 1,
                "hosts_with_active_failures": 0,
                "total_groups": 3,
                "groups_with_active_failures": 0,
                "has_inventory_sources": false,
                "total_inventory_sources": 0,
                "inventory_sources_with_failures": 0,
                "organization_id": 1,
                "kind": ""
            },
            "created_by": {
                "id": 2,
                "username": "admin",
                "first_name": "",
                "last_name": ""
            },
            "modified_by": {
                "id": 2,
                "username": "admin",
                "first_name": "",
                "last_name": ""
            },
            "user_capabilities": {
                "edit": true,
                "delete": true
            },
            "groups": {
                "count": 0,
                "results": []
            },
            "recent_jobs": []
        },
        "created": "2018-09-01T11:18:16.456501Z",
        "modified": "2018-09-01T11:18:16.456512Z",
        "name": "testUpdate",
        "description": "test create host",
        "inventory": 1,
        "enabled": true,
        "instance_id": "",
        "variables": "ansible_host: localhost",
        "has_active_failures": false,
        "has_inventory_sources": false,
        "last_job": null,
        "last_job_host_summary": null,
        "insights_system_id": null,
        "ansible_facts_modified": null
    }`)

	// MockedDeleteHostResponse mocked `DeleteHost` endpoint response
	MockedDeleteHostResponse = []byte(`{}`)
)
View Source
var (
	// MockedListInventoriesResponse mocked `ListInventories` endpoint response
	MockedListInventoriesResponse = []byte(`
{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 1,
            "type": "inventory",
            "url": "/api/v2/inventories/1/",
            "related": {
                "created_by": "/api/v2/users/1/",
                "modified_by": "/api/v2/users/1/",
                "job_templates": "/api/v2/inventories/1/job_templates/",
                "variable_data": "/api/v2/inventories/1/variable_data/",
                "root_groups": "/api/v2/inventories/1/root_groups/",
                "object_roles": "/api/v2/inventories/1/object_roles/",
                "ad_hoc_commands": "/api/v2/inventories/1/ad_hoc_commands/",
                "script": "/api/v2/inventories/1/script/",
                "tree": "/api/v2/inventories/1/tree/",
                "access_list": "/api/v2/inventories/1/access_list/",
                "activity_stream": "/api/v2/inventories/1/activity_stream/",
                "instance_groups": "/api/v2/inventories/1/instance_groups/",
                "hosts": "/api/v2/inventories/1/hosts/",
                "groups": "/api/v2/inventories/1/groups/",
                "copy": "/api/v2/inventories/1/copy/",
                "update_inventory_sources": "/api/v2/inventories/1/update_inventory_sources/",
                "inventory_sources": "/api/v2/inventories/1/inventory_sources/",
                "organization": "/api/v2/organizations/1/"
            },
            "summary_fields": {
                "organization": {
                    "id": 1,
                    "name": "Default",
                    "description": ""
                },
                "created_by": {
                    "id": 1,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "modified_by": {
                    "id": 1,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "object_roles": {
                    "use_role": {
                        "id": 23,
                        "description": "Can use the inventory in a job template",
                        "name": "Use"
                    },
                    "admin_role": {
                        "id": 21,
                        "description": "Can manage all aspects of the inventory",
                        "name": "Admin"
                    },
                    "adhoc_role": {
                        "id": 20,
                        "description": "May run ad hoc commands on an inventory",
                        "name": "Ad Hoc"
                    },
                    "update_role": {
                        "id": 24,
                        "description": "May update project or inventory or group using the configured source update system",
                        "name": "Update"
                    },
                    "read_role": {
                        "id": 22,
                        "description": "May view settings for the inventory",
                        "name": "Read"
                    }
                },
                "user_capabilities": {
                    "edit": true,
                    "copy": true,
                    "adhoc": true,
                    "delete": true
                }
            },
            "created": "2018-05-21T01:34:35.657185Z",
            "modified": "2018-05-30T09:42:22.412749Z",
            "name": "Demo Inventory",
            "description": "",
            "organization": 1,
            "kind": "",
            "host_filter": null,
            "variables": "",
            "has_active_failures": false,
            "total_hosts": 2,
            "hosts_with_active_failures": 0,
            "total_groups": 0,
            "groups_with_active_failures": 0,
            "has_inventory_sources": false,
            "total_inventory_sources": 0,
            "inventory_sources_with_failures": 0,
            "insights_credential": null,
            "pending_deletion": false
        }
    ]
}`)

	// MockedCreateInventoryResponse mocked `CreateInventory` endpoint response
	MockedCreateInventoryResponse = []byte(`
{
    "id": 6,
    "type": "inventory",
    "url": "/api/v2/inventories/6/",
    "related": {
        "named_url": "/api/v2/inventories/TestInventory++Default/",
        "created_by": "/api/v2/users/1/",
        "modified_by": "/api/v2/users/1/",
        "job_templates": "/api/v2/inventories/6/job_templates/",
        "variable_data": "/api/v2/inventories/6/variable_data/",
        "root_groups": "/api/v2/inventories/6/root_groups/",
        "object_roles": "/api/v2/inventories/6/object_roles/",
        "ad_hoc_commands": "/api/v2/inventories/6/ad_hoc_commands/",
        "script": "/api/v2/inventories/6/script/",
        "tree": "/api/v2/inventories/6/tree/",
        "access_list": "/api/v2/inventories/6/access_list/",
        "activity_stream": "/api/v2/inventories/6/activity_stream/",
        "instance_groups": "/api/v2/inventories/6/instance_groups/",
        "hosts": "/api/v2/inventories/6/hosts/",
        "groups": "/api/v2/inventories/6/groups/",
        "copy": "/api/v2/inventories/6/copy/",
        "update_inventory_sources": "/api/v2/inventories/6/update_inventory_sources/",
        "inventory_sources": "/api/v2/inventories/6/inventory_sources/",
        "organization": "/api/v2/organizations/1/"
    },
    "summary_fields": {
        "organization": {
            "id": 1,
            "name": "Default",
            "description": ""
        },
        "created_by": {
            "id": 1,
            "username": "admin",
            "first_name": "",
            "last_name": ""
        },
        "modified_by": {
            "id": 1,
            "username": "admin",
            "first_name": "",
            "last_name": ""
        },
        "object_roles": {
            "use_role": {
                "id": 80,
                "description": "Can use the inventory in a job template",
                "name": "Use"
            },
            "admin_role": {
                "id": 78,
                "description": "Can manage all aspects of the inventory",
                "name": "Admin"
            },
            "adhoc_role": {
                "id": 77,
                "description": "May run ad hoc commands on an inventory",
                "name": "Ad Hoc"
            },
            "update_role": {
                "id": 81,
                "description": "May update project or inventory or group using the configured source update system",
                "name": "Update"
            },
            "read_role": {
                "id": 79,
                "description": "May view settings for the inventory",
                "name": "Read"
            }
        },
        "user_capabilities": {
            "edit": true,
            "copy": true,
            "adhoc": true,
            "delete": true
        }
    },
    "created": "2018-08-13T01:59:47.160127Z",
    "modified": "2018-08-13T01:59:47.160140Z",
    "name": "TestInventory",
    "description": "for testing CreateInventory api",
    "organization": 1,
    "kind": "",
    "host_filter": null,
    "variables": "",
    "has_active_failures": false,
    "total_hosts": 0,
    "hosts_with_active_failures": 0,
    "total_groups": 0,
    "groups_with_active_failures": 0,
    "has_inventory_sources": false,
    "total_inventory_sources": 0,
    "inventory_sources_with_failures": 0,
    "insights_credential": null,
    "pending_deletion": false
}`)

	// MockedUpdateInventoryResponse mocked `UpdateInventory` endpoint response
	MockedUpdateInventoryResponse = []byte(`
{
        "id": 6,
        "type": "inventory",
        "url": "/api/v2/inventories/6/",
        "related": {
            "named_url": "/api/v2/inventories/TestInventory-update1++Default/",
            "created_by": "/api/v2/users/1/",
            "modified_by": "/api/v2/users/1/",
            "job_templates": "/api/v2/inventories/6/job_templates/",
            "variable_data": "/api/v2/inventories/6/variable_data/",
            "root_groups": "/api/v2/inventories/6/root_groups/",
            "object_roles": "/api/v2/inventories/6/object_roles/",
            "ad_hoc_commands": "/api/v2/inventories/6/ad_hoc_commands/",
            "script": "/api/v2/inventories/6/script/",
            "tree": "/api/v2/inventories/6/tree/",
            "access_list": "/api/v2/inventories/6/access_list/",
            "activity_stream": "/api/v2/inventories/6/activity_stream/",
            "instance_groups": "/api/v2/inventories/6/instance_groups/",
            "hosts": "/api/v2/inventories/6/hosts/",
            "groups": "/api/v2/inventories/6/groups/",
            "copy": "/api/v2/inventories/6/copy/",
            "update_inventory_sources": "/api/v2/inventories/6/update_inventory_sources/",
            "inventory_sources": "/api/v2/inventories/6/inventory_sources/",
            "organization": "/api/v2/organizations/1/"
        },
        "summary_fields": {
            "organization": {
                "id": 1,
                "name": "Default",
                "description": ""
            },
            "created_by": {
                "id": 1,
                "username": "admin",
                "first_name": "",
                "last_name": ""
            },
            "modified_by": {
                "id": 1,
                "username": "admin",
                "first_name": "",
                "last_name": ""
            },
            "object_roles": {
                "use_role": {
                    "id": 80,
                    "description": "Can use the inventory in a job template",
                    "name": "Use"
                },
                "admin_role": {
                    "id": 78,
                    "description": "Can manage all aspects of the inventory",
                    "name": "Admin"
                },
                "adhoc_role": {
                    "id": 77,
                    "description": "May run ad hoc commands on an inventory",
                    "name": "Ad Hoc"
                },
                "update_role": {
                    "id": 81,
                    "description": "May update project or inventory or group using the configured source update system",
                    "name": "Update"
                },
                "read_role": {
                    "id": 79,
                    "description": "May view settings for the inventory",
                    "name": "Read"
                }
            },
            "user_capabilities": {
                "edit": true,
                "copy": true,
                "adhoc": true,
                "delete": true
            }
        },
        "created": "2018-08-13T01:59:47.160127Z",
        "modified": "2018-08-13T01:59:47.160140Z",
        "name": "TestInventory-update1",
        "description": "for testing UpdateInventory api",
        "organization": 1,
        "kind": "",
        "host_filter": null,
        "variables": "",
        "has_active_failures": false,
        "total_hosts": 0,
        "hosts_with_active_failures": 0,
        "total_groups": 0,
        "groups_with_active_failures": 0,
        "has_inventory_sources": false,
        "total_inventory_sources": 0,
        "inventory_sources_with_failures": 0,
        "insights_credential": null,
        "pending_deletion": false
    }`)

	// MockedDeleteInventoryResponse mocked `Delete` endpoint response
	MockedDeleteInventoryResponse = []byte(`{}`)

	// MockedGetInventoryResponse mocked `GetInventory` endpoint response
	MockedGetInventoryResponse = []byte(`
        {
            "id": 1,
            "type": "inventory",
            "url": "/api/v2/inventories/1/",
            "related": {
                "created_by": "/api/v2/users/1/",
                "modified_by": "/api/v2/users/1/",
                "job_templates": "/api/v2/inventories/1/job_templates/",
                "variable_data": "/api/v2/inventories/1/variable_data/",
                "root_groups": "/api/v2/inventories/1/root_groups/",
                "object_roles": "/api/v2/inventories/1/object_roles/",
                "ad_hoc_commands": "/api/v2/inventories/1/ad_hoc_commands/",
                "script": "/api/v2/inventories/1/script/",
                "tree": "/api/v2/inventories/1/tree/",
                "access_list": "/api/v2/inventories/1/access_list/",
                "activity_stream": "/api/v2/inventories/1/activity_stream/",
                "instance_groups": "/api/v2/inventories/1/instance_groups/",
                "hosts": "/api/v2/inventories/1/hosts/",
                "groups": "/api/v2/inventories/1/groups/",
                "copy": "/api/v2/inventories/1/copy/",
                "update_inventory_sources": "/api/v2/inventories/1/update_inventory_sources/",
                "inventory_sources": "/api/v2/inventories/1/inventory_sources/",
                "organization": "/api/v2/organizations/1/"
            },
            "summary_fields": {
                "organization": {
                    "id": 1,
                    "name": "Default",
                    "description": ""
                },
                "created_by": {
                    "id": 1,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "modified_by": {
                    "id": 1,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "object_roles": {
                    "use_role": {
                        "id": 80,
                        "description": "Can use the inventory in a job template",
                        "name": "Use"
                    },
                    "admin_role": {
                        "id": 78,
                        "description": "Can manage all aspects of the inventory",
                        "name": "Admin"
                    },
                    "adhoc_role": {
                        "id": 77,
                        "description": "May run ad hoc commands on an inventory",
                        "name": "Ad Hoc"
                    },
                    "update_role": {
                        "id": 81,
                        "description": "May update project or inventory or group using the configured source update system",
                        "name": "Update"
                    },
                    "read_role": {
                        "id": 79,
                        "description": "May view settings for the inventory",
                        "name": "Read"
                    }
                },
                "user_capabilities": {
                    "edit": true,
                    "copy": true,
                    "adhoc": true,
                    "delete": true
                }
            },
            "created": "2018-05-21T01:34:35.657185Z",
            "modified": "2018-05-30T09:42:22.412749Z",
            "name": "Demo Inventory",
            "description": "",
            "organization": 1,
            "kind": "",
            "host_filter": null,
            "variables": "",
            "has_active_failures": false,
            "total_hosts": 2,
            "hosts_with_active_failures": 0,
            "total_groups": 0,
            "groups_with_active_failures": 0,
            "has_inventory_sources": false,
            "total_inventory_sources": 0,
            "inventory_sources_with_failures": 0,
            "insights_credential": null,
            "pending_deletion": false
        }`)
)
View Source
var (
	// MockedInventoryUpdatesResponse mocked `SyncInventorySourcesByInventoryID` endpoint response
	MockedInventoryUpdatesResponse = []byte(`
    [
        {
            "inventory_source": 10,
            "status": "started",
            "id": 305,
            "type": "inventory_update",
            "url": "/api/v2/inventory_updates/305/",
            "related": {
                "created_by": "/api/v2/users/5/",
                "modified_by": "/api/v2/users/5/",
                "unified_job_template": "/api/v2/inventory_sources/10/",
                "stdout": "/api/v2/inventory_updates/305/stdout/",
                "inventory_source": "/api/v2/inventory_sources/10/",
                "cancel": "/api/v2/inventory_updates/305/cancel/",
                "notifications": "/api/v2/inventory_updates/305/notifications/",
                "events": "/api/v2/inventory_updates/305/events/",
                "inventory": "/api/v2/inventories/1/",
                "credentials": "/api/v2/inventory_updates/305/credentials/"
            },
            "summary_fields": {
                "organization": {
                    "id": 1,
                    "name": "Default",
                    "description": ""
                },
                "inventory": {
                    "id": 1,
                    "name": "Default",
                    "description": "",
                    "has_active_failures": true,
                    "total_hosts": 7,
                    "hosts_with_active_failures": 6,
                    "total_groups": 14,
                    "has_inventory_sources": true,
                    "total_inventory_sources": 1,
                    "inventory_sources_with_failures": 0,
                    "organization_id": 1,
                    "kind": ""
                },
                "unified_job_template": {
                    "id": 10,
                    "name": "Default",
                    "description": "",
                    "unified_job_type": "inventory_update"
                },
                "inventory_source": {
                    "source": "scm",
                    "last_updated": "2021-07-30T10:12:44.553099Z",
                    "status": "pending"
                },
                "created_by": {
                    "id": 5,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "modified_by": {
                    "id": 5,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "user_capabilities": {
                    "delete": true,
                    "start": true
                },
                "credentials": []
            },
            "created": "2021-08-02T01:45:22.144755Z",
            "modified": "2021-08-02T01:45:22.157220Z",
            "name": "Default",
            "description": "",
            "source": "scm",
            "source_path": "",
            "source_script": null,
            "source_vars": "",
            "credential": null,
            "enabled_var": "",
            "enabled_value": "",
            "host_filter": "",
            "overwrite": true,
            "overwrite_vars": true,
            "custom_virtualenv": null,
            "timeout": 0,
            "verbosity": 2,
            "unified_job_template": 10,
            "launch_type": "manual",
            "failed": false,
            "started": null,
            "finished": null,
            "canceled_on": null,
            "elapsed": 0.0,
            "job_args": "",
            "job_cwd": "",
            "job_env": null,
            "job_explanation": "",
            "execution_node": "",
            "result_traceback": "",
            "event_processing_finished": false,
            "inventory": 1,
            "license_error": false,
            "org_host_limit_error": false,
            "source_project_update": null,
            "source_project": null,
            "inventory_update": 305
        }
    ]`)

	// MockedInventoryUpdateResponse mocked `GetInventoryUpdate` endpoint response
	MockedInventoryUpdateResponse = []byte(`
        {
            "status": "successful",
            "id": 305,
            "type": "inventory_update",
            "url": "/api/v2/inventory_updates/305/",
            "related": {
                "created_by": "/api/v2/users/5/",
                "modified_by": "/api/v2/users/5/",
                "unified_job_template": "/api/v2/inventory_sources/10/",
                "stdout": "/api/v2/inventory_updates/305/stdout/",
                "inventory_source": "/api/v2/inventory_sources/10/",
                "cancel": "/api/v2/inventory_updates/305/cancel/",
                "notifications": "/api/v2/inventory_updates/305/notifications/",
                "events": "/api/v2/inventory_updates/305/events/",
                "inventory": "/api/v2/inventories/1/",
                "credentials": "/api/v2/inventory_updates/305/credentials/"
            },
            "summary_fields": {
                "organization": {
                    "id": 1,
                    "name": "Default",
                    "description": ""
                },
                "inventory": {
                    "id": 1,
                    "name": "Default",
                    "description": "",
                    "has_active_failures": true,
                    "total_hosts": 7,
                    "hosts_with_active_failures": 6,
                    "total_groups": 14,
                    "has_inventory_sources": true,
                    "total_inventory_sources": 1,
                    "inventory_sources_with_failures": 0,
                    "organization_id": 1,
                    "kind": ""
                },
                "unified_job_template": {
                    "id": 10,
                    "name": "Default",
                    "description": "",
                    "unified_job_type": "inventory_update"
                },
                "inventory_source": {
                    "source": "scm",
                    "last_updated": "2021-07-30T10:12:44.553099Z",
                    "status": "pending"
                },
                "created_by": {
                    "id": 5,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "modified_by": {
                    "id": 5,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "user_capabilities": {
                    "delete": true,
                    "start": true
                },
                "credentials": []
            },
            "created": "2021-08-02T01:45:22.144755Z",
            "modified": "2021-08-02T01:45:22.157220Z",
            "name": "Default",
            "description": "",
            "source": "scm",
            "source_path": "",
            "source_script": null,
            "source_vars": "",
            "credential": null,
            "enabled_var": "",
            "enabled_value": "",
            "host_filter": "",
            "overwrite": true,
            "overwrite_vars": true,
            "custom_virtualenv": null,
            "timeout": 0,
            "verbosity": 2,
            "unified_job_template": 10,
            "launch_type": "manual",
            "failed": false,
            "started": null,
            "finished": null,
            "canceled_on": null,
            "elapsed": 0.0,
            "job_args": "",
            "job_cwd": "",
            "job_env": null,
            "job_explanation": "",
            "execution_node": "",
            "result_traceback": "",
            "event_processing_finished": false,
            "inventory": 1,
            "license_error": false,
            "org_host_limit_error": false,
            "source_project_update": null,
            "source_project": null,
            "inventory_update": 305
		}`)
)
View Source
var (
	// MockedGetJobResponse mocked `GetJob` endpoint response
	MockedGetJobResponse = []byte(`
{
    "id": 301,
    "type": "job",
    "url": "/api/v2/jobs/301/",
    "related": {
        "created_by": "/api/v2/users/1/",
        "labels": "/api/v2/jobs/301/labels/",
        "inventory": "/api/v2/inventories/1/",
        "project": "/api/v2/projects/6/",
        "extra_credentials": "/api/v2/jobs/301/extra_credentials/",
        "credentials": "/api/v2/jobs/301/credentials/",
        "unified_job_template": "/api/v2/job_templates/8/",
        "stdout": "/api/v2/jobs/301/stdout/",
        "notifications": "/api/v2/jobs/301/notifications/",
        "job_host_summaries": "/api/v2/jobs/301/job_host_summaries/",
        "job_events": "/api/v2/jobs/301/job_events/",
        "activity_stream": "/api/v2/jobs/301/activity_stream/",
        "job_template": "/api/v2/job_templates/8/",
        "cancel": "/api/v2/jobs/301/cancel/",
        "project_update": "/api/v2/project_updates/303/",
        "create_schedule": "/api/v2/jobs/301/create_schedule/",
        "relaunch": "/api/v2/jobs/301/relaunch/"
    },
    "summary_fields": {
        "instance_group": {
            "id": 1,
            "name": "tower"
        },
        "job_template": {
            "id": 8,
            "name": "Hello-world",
            "description": ""
        },
        "inventory": {
            "id": 1,
            "name": "Demo Inventory",
            "description": "",
            "has_active_failures": false,
            "total_hosts": 2,
            "hosts_with_active_failures": 0,
            "total_groups": 0,
            "groups_with_active_failures": 0,
            "has_inventory_sources": false,
            "total_inventory_sources": 0,
            "inventory_sources_with_failures": 0,
            "organization_id": 1,
            "kind": ""
        },
        "project_update": {
            "id": 303,
            "name": "DeployBook",
            "description": "",
            "status": "successful",
            "failed": false
        },
        "unified_job_template": {
            "id": 8,
            "name": "Hello-world",
            "description": "",
            "unified_job_type": "job"
        },
        "project": {
            "id": 6,
            "name": "DeployBook",
            "description": "",
            "status": "successful",
            "scm_type": "git"
        },
        "created_by": {
            "id": 1,
            "username": "admin",
            "first_name": "",
            "last_name": ""
        },
        "user_capabilities": {
            "start": true,
            "delete": true
        },
        "labels": {
            "count": 0,
            "results": []
        },
        "extra_credentials": [],
        "credentials": []
    },
    "created": "2018-06-05T09:13:43.046077Z",
    "modified": "2018-06-05T09:13:49.132905Z",
    "name": "Hello-world",
    "description": "",
    "job_type": "run",
    "inventory": 1,
    "project": 6,
    "playbook": "hello-world.yml",
    "forks": 0,
    "limit": "localhost",
    "verbosity": 0,
    "extra_vars": "{}",
    "job_tags": "",
    "force_handlers": false,
    "skip_tags": "",
    "start_at_task": "",
    "timeout": 0,
    "use_fact_cache": false,
    "unified_job_template": 8,
    "launch_type": "manual",
    "status": "canceled",
    "failed": true,
    "started": "2018-06-05T09:13:47.060276Z",
    "finished": "2018-06-05T09:13:54.740342Z",
    "elapsed": 7.68,
    "job_args": "[\"ansible-playbook\", \"-i\", \"/tmp/awx_301_3kuP6Z/tmpupf88B\", \"-u\", \"root\", \"-l\", \"localhost\", \"-e\", \"@/tmp/awx_301_3kuP6Z/tmpjlw9Dp\", \"hello-world.yml\"]",
    "job_cwd": "/var/lib/awx/projects/_6__deploybook",
    "job_env": {},
    "job_explanation": "",
    "execution_node": "awx",
    "result_traceback": "",
    "event_processing_finished": true,
    "job_template": 8,
    "passwords_needed_to_start": [],
    "ask_diff_mode_on_launch": false,
    "ask_variables_on_launch": true,
    "ask_limit_on_launch": true,
    "ask_tags_on_launch": false,
    "ask_skip_tags_on_launch": false,
    "ask_job_type_on_launch": false,
    "ask_verbosity_on_launch": false,
    "ask_inventory_on_launch": true,
    "ask_credential_on_launch": false,
    "allow_simultaneous": false,
    "artifacts": {},
    "scm_revision": "ae9cc6b0fee9aea55e10a4a325c9ae3d97c42f1a",
    "instance_group": 1,
    "diff_mode": false,
    "credential": null,
    "vault_credential": null
}`)

	// MockedCancelJobResponse mocked `CancelJob` endpoint response
	MockedCancelJobResponse = []byte(`{
    "detail": "Method \"POST\" not allowed."
}`)

	// MockedHostSummariesResponse mocked `HostSummaries` endpoint response
	MockedHostSummariesResponse = []byte(`{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 65,
            "type": "job_host_summary",
            "url": "/api/v2/job_host_summaries/65/",
            "related": {
                "job": "/api/v2/jobs/301/",
                "host": "/api/v2/hosts/1/"
            },
            "summary_fields": {
                "job": {
                    "id": 301,
                    "name": "Hello-world",
                    "description": "",
                    "status": "canceled",
                    "failed": true,
                    "elapsed": 7.68,
                    "job_template_id": 8,
                    "job_template_name": "Hello-world"
                },
                "host": {
                    "id": 1,
                    "name": "localhost",
                    "description": "",
                    "has_active_failures": false,
                    "has_inventory_sources": false
                }
            },
            "created": "2018-06-05T09:13:51.619497Z",
            "modified": "2018-06-05T09:13:51.619511Z",
            "job": 301,
            "host": 1,
            "host_name": "localhost",
            "changed": 1,
            "dark": 0,
            "failures": 0,
            "ok": 1,
            "processed": 1,
            "skipped": 0,
            "failed": false
        }
    ]
}`)

	// MockedJobEventsResponse mocked `JobEvents` endpoint response
	MockedJobEventsResponse = []byte(`{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 682,
            "type": "job_event",
            "url": "/api/v2/job_events/682/",
            "related": {
                "job": "/api/v2/jobs/301/"
            },
            "summary_fields": {
                "role": {},
                "job": {
                    "id": 301,
                    "name": "Hello-world",
                    "description": "",
                    "status": "canceled",
                    "failed": true,
                    "elapsed": 7.68,
                    "job_template_id": 8,
                    "job_template_name": "Hello-world"
                }
            },
            "created": "2018-06-05T09:13:51.249805Z",
            "modified": "2018-06-05T09:13:51.249818Z",
            "job": 301,
            "event": "verbose",
            "counter": 1,
            "event_display": "Verbose",
            "event_data": {},
            "event_level": 0,
            "failed": false,
            "changed": false,
            "uuid": "",
            "parent_uuid": "",
            "host": null,
            "host_name": "",
            "parent": null,
            "playbook": "",
            "play": "",
            "task": "",
            "role": "",
            "stdout": "\u001b[0;31m [ERROR]:\u001b[0m",
            "start_line": 0,
            "end_line": 1,
            "verbosity": 0
        }
    ]
}`)
)
View Source
var (
	// MockedListJobTemplatesResponse mocked `ListJobTemplates` endpoint response
	MockedListJobTemplatesResponse = []byte(`
{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 5,
            "type": "job_template",
            "url": "/api/v2/job_templates/5/",
            "related": {
                "created_by": "/api/v2/users/1/",
                "modified_by": "/api/v2/users/1/",
                "labels": "/api/v2/job_templates/5/labels/",
                "inventory": "/api/v2/inventories/1/",
                "project": "/api/v2/projects/4/",
                "credential": "/api/v2/credentials/1/",
                "extra_credentials": "/api/v2/job_templates/5/extra_credentials/",
                "credentials": "/api/v2/job_templates/5/credentials/",
                "notification_templates_error": "/api/v2/job_templates/5/notification_templates_error/",
                "notification_templates_success": "/api/v2/job_templates/5/notification_templates_success/",
                "jobs": "/api/v2/job_templates/5/jobs/",
                "object_roles": "/api/v2/job_templates/5/object_roles/",
                "notification_templates_any": "/api/v2/job_templates/5/notification_templates_any/",
                "access_list": "/api/v2/job_templates/5/access_list/",
                "launch": "/api/v2/job_templates/5/launch/",
                "instance_groups": "/api/v2/job_templates/5/instance_groups/",
                "schedules": "/api/v2/job_templates/5/schedules/",
                "copy": "/api/v2/job_templates/5/copy/",
                "activity_stream": "/api/v2/job_templates/5/activity_stream/",
                "survey_spec": "/api/v2/job_templates/5/survey_spec/"
            },
            "summary_fields": {
                "inventory": {
                    "id": 1,
                    "name": "Demo Inventory",
                    "description": "",
                    "has_active_failures": false,
                    "total_hosts": 2,
                    "hosts_with_active_failures": 0,
                    "total_groups": 0,
                    "groups_with_active_failures": 0,
                    "has_inventory_sources": false,
                    "total_inventory_sources": 0,
                    "inventory_sources_with_failures": 0,
                    "organization_id": 1,
                    "kind": ""
                },
                "project": {
                    "id": 4,
                    "name": "Demo Project",
                    "description": "",
                    "status": "never updated",
                    "scm_type": "git"
                },
                "created_by": {
                    "id": 1,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "modified_by": {
                    "id": 1,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "object_roles": {
                    "admin_role": {
                        "id": 27,
                        "description": "Can manage all aspects of the job template",
                        "name": "Admin"
                    },
                    "execute_role": {
                        "id": 26,
                        "description": "May run the job template",
                        "name": "Execute"
                    },
                    "read_role": {
                        "id": 25,
                        "description": "May view settings for the job template",
                        "name": "Read"
                    }
                },
                "user_capabilities": {
                    "edit": true,
                    "start": true,
                    "copy": true,
                    "schedule": true,
                    "delete": true
                },
                "labels": {
                    "count": 0,
                    "results": []
                },
                "recent_jobs": [],
                "credentials": [
                    {
                        "description": "",
                        "credential_type_id": 1,
                        "id": 1,
                        "kind": "ssh",
                        "name": "Demo Credential"
                    }
                ]
            },
            "created": "2018-05-21T01:34:35.773593Z",
            "modified": "2018-05-21T01:34:35.773605Z",
            "name": "Demo Job Template",
            "description": "",
            "job_type": "run",
            "inventory": 1,
            "project": 4,
            "playbook": "hello-world.yml",
            "forks": 0,
            "limit": "",
            "verbosity": 0,
            "extra_vars": "",
            "job_tags": "",
            "force_handlers": false,
            "skip_tags": "",
            "start_at_task": "",
            "timeout": 0,
            "use_fact_cache": false,
            "last_job_run": null,
            "last_job_failed": false,
            "next_job_run": null,
            "status": "never updated",
            "host_config_key": "",
            "ask_diff_mode_on_launch": false,
            "ask_variables_on_launch": false,
            "ask_limit_on_launch": false,
            "ask_tags_on_launch": false,
            "ask_skip_tags_on_launch": false,
            "ask_job_type_on_launch": false,
            "ask_verbosity_on_launch": false,
            "ask_inventory_on_launch": false,
            "ask_credential_on_launch": false,
            "survey_enabled": false,
            "become_enabled": false,
            "diff_mode": false,
            "allow_simultaneous": false,
            "custom_virtualenv": null,
            "credential": 1,
            "vault_credential": null
        }
    ]
}`)

	// MockedLaunchJobTemplateResponse mocked `LaunchJobTemplate` endpoint response
	MockedLaunchJobTemplateResponse = []byte(`
{
    "job": 499,
    "ignored_fields": {},
    "id": 499,
    "type": "job",
    "url": "/api/v2/jobs/499/",
    "related": {
        "created_by": "/api/v2/users/1/",
        "modified_by": "/api/v2/users/1/",
        "labels": "/api/v2/jobs/499/labels/",
        "inventory": "/api/v2/inventories/1/",
        "project": "/api/v2/projects/4/",
        "credential": "/api/v2/credentials/1/",
        "extra_credentials": "/api/v2/jobs/499/extra_credentials/",
        "credentials": "/api/v2/jobs/499/credentials/",
        "unified_job_template": "/api/v2/job_templates/5/",
        "stdout": "/api/v2/jobs/499/stdout/",
        "notifications": "/api/v2/jobs/499/notifications/",
        "job_host_summaries": "/api/v2/jobs/499/job_host_summaries/",
        "job_events": "/api/v2/jobs/499/job_events/",
        "activity_stream": "/api/v2/jobs/499/activity_stream/",
        "job_template": "/api/v2/job_templates/5/",
        "cancel": "/api/v2/jobs/499/cancel/",
        "create_schedule": "/api/v2/jobs/499/create_schedule/",
        "relaunch": "/api/v2/jobs/499/relaunch/"
    },
    "summary_fields": {
        "job_template": {
            "id": 5,
            "name": "Demo Job Template",
            "description": ""
        },
        "inventory": {
            "id": 1,
            "name": "Demo Inventory",
            "description": "",
            "has_active_failures": false,
            "total_hosts": 2,
            "hosts_with_active_failures": 0,
            "total_groups": 0,
            "groups_with_active_failures": 0,
            "has_inventory_sources": false,
            "total_inventory_sources": 0,
            "inventory_sources_with_failures": 0,
            "organization_id": 1,
            "kind": ""
        },
        "credential": {
            "description": "",
            "credential_type_id": 1,
            "id": 1,
            "kind": "ssh",
            "name": "Demo Credential"
        },
        "unified_job_template": {
            "id": 5,
            "name": "Demo Job Template",
            "description": "",
            "unified_job_type": "job"
        },
        "project": {
            "id": 4,
            "name": "Demo Project",
            "description": "",
            "status": "successful",
            "scm_type": "git"
        },
        "created_by": {
            "id": 1,
            "username": "admin",
            "first_name": "",
            "last_name": ""
        },
        "modified_by": {
            "id": 1,
            "username": "admin",
            "first_name": "",
            "last_name": ""
        },
        "user_capabilities": {
            "start": true,
            "delete": true
        },
        "labels": {
            "count": 0,
            "results": []
        },
        "extra_credentials": [],
        "credentials": [
            {
                "description": "",
                "credential_type_id": 1,
                "id": 1,
                "kind": "ssh",
                "name": "Demo Credential"
            }
        ]
    },
    "created": "2018-06-25T04:25:11.312072Z",
    "modified": "2018-06-25T04:25:11.362046Z",
    "name": "Demo Job Template",
    "description": "",
    "job_type": "run",
    "inventory": 1,
    "project": 4,
    "playbook": "hello-world.yml",
    "forks": 0,
    "limit": "",
    "verbosity": 0,
    "extra_vars": "{}",
    "job_tags": "",
    "force_handlers": false,
    "skip_tags": "",
    "start_at_task": "",
    "timeout": 0,
    "use_fact_cache": false,
    "unified_job_template": 5,
    "launch_type": "manual",
    "status": "pending",
    "failed": false,
    "started": null,
    "finished": null,
    "elapsed": 0,
    "job_args": "",
    "job_cwd": "",
    "job_env": {},
    "job_explanation": "",
    "execution_node": "",
    "result_traceback": "",
    "event_processing_finished": false,
    "job_template": 5,
    "passwords_needed_to_start": [],
    "ask_diff_mode_on_launch": false,
    "ask_variables_on_launch": false,
    "ask_limit_on_launch": false,
    "ask_tags_on_launch": false,
    "ask_skip_tags_on_launch": false,
    "ask_job_type_on_launch": false,
    "ask_verbosity_on_launch": false,
    "ask_inventory_on_launch": false,
    "ask_credential_on_launch": false,
    "allow_simultaneous": false,
    "artifacts": {},
    "scm_revision": "",
    "instance_group": null,
    "diff_mode": false,
    "credential": 1,
    "vault_credential": null
}`)

	// MockedCreateJobTemplateResponse mocked `CreateJobTemplate` endpoint response
	MockedCreateJobTemplateResponse = []byte(`
{
    "id": 5,
    "type": "job_template",
    "url": "/api/v2/job_templates/5/",
    "related": {
        "named_url": "/api/v2/job_templates/Demo Job Template/",
        "created_by": "/api/v2/users/1/",
        "modified_by": "/api/v2/users/1/",
        "labels": "/api/v2/job_templates/5/labels/",
        "inventory": "/api/v2/inventories/1/",
        "project": "/api/v2/projects/4/",
        "credential": "/api/v2/credentials/1/",
        "extra_credentials": "/api/v2/job_templates/5/extra_credentials/",
        "credentials": "/api/v2/job_templates/5/credentials/",
        "notification_templates_error": "/api/v2/job_templates/5/notification_templates_error/",
        "notification_templates_success": "/api/v2/job_templates/5/notification_templates_success/",
        "jobs": "/api/v2/job_templates/5/jobs/",
        "object_roles": "/api/v2/job_templates/5/object_roles/",
        "notification_templates_any": "/api/v2/job_templates/5/notification_templates_any/",
        "access_list": "/api/v2/job_templates/5/access_list/",
        "launch": "/api/v2/job_templates/5/launch/",
        "instance_groups": "/api/v2/job_templates/5/instance_groups/",
        "schedules": "/api/v2/job_templates/5/schedules/",
        "copy": "/api/v2/job_templates/5/copy/",
        "activity_stream": "/api/v2/job_templates/5/activity_stream/",
        "survey_spec": "/api/v2/job_templates/5/survey_spec/"
    },
    "summary_fields": {
        "inventory": {
            "id": 1,
            "name": "Demo Inventory",
            "description": "",
            "has_active_failures": false,
            "total_hosts": 2,
            "hosts_with_active_failures": 0,
            "total_groups": 0,
            "groups_with_active_failures": 0,
            "has_inventory_sources": false,
            "total_inventory_sources": 0,
            "inventory_sources_with_failures": 0,
            "organization_id": 1,
            "kind": ""
        },
        "project": {
            "id": 4,
            "name": "Demo Project",
            "description": "",
            "status": "never updated",
            "scm_type": "git"
        },
        "created_by": {
            "id": 1,
            "username": "admin",
            "first_name": "",
            "last_name": ""
        },
        "modified_by": {
            "id": 1,
            "username": "admin",
            "first_name": "",
            "last_name": ""
        },
        "object_roles": {
            "admin_role": {
                "id": 28,
                "description": "Can manage all aspects of the job template",
                "name": "Admin"
            },
            "execute_role": {
                "id": 27,
                "description": "May run the job template",
                "name": "Execute"
            },
            "read_role": {
                "id": 26,
                "description": "May view settings for the job template",
                "name": "Read"
            }
        },
        "user_capabilities": {
            "edit": true,
            "start": true,
            "copy": true,
            "schedule": true,
            "delete": true
        },
        "labels": {
            "count": 0,
            "results": []
        },
        "recent_jobs": [],
        "extra_credentials": [],
        "credentials": [
            {
                "description": "",
                "credential_type_id": 1,
                "id": 1,
                "kind": "ssh",
                "name": "Demo Credential"
            }
        ]
    },
    "created": "2018-06-28T16:31:16.238510Z",
    "modified": "2018-06-28T16:31:16.238524Z",
    "name": "Demo Job Template",
    "description": "",
    "job_type": "run",
    "inventory": 1,
    "project": 4,
    "playbook": "hello_world.yml",
    "forks": 0,
    "limit": "",
    "verbosity": 0,
    "extra_vars": "",
    "job_tags": "",
    "force_handlers": false,
    "skip_tags": "",
    "start_at_task": "",
    "timeout": 0,
    "use_fact_cache": false,
    "last_job_run": null,
    "last_job_failed": false,
    "next_job_run": null,
    "status": "never updated",
    "host_config_key": "",
    "ask_diff_mode_on_launch": false,
    "ask_variables_on_launch": false,
    "ask_limit_on_launch": false,
    "ask_tags_on_launch": false,
    "ask_skip_tags_on_launch": false,
    "ask_job_type_on_launch": false,
    "ask_verbosity_on_launch": false,
    "ask_inventory_on_launch": false,
    "ask_credential_on_launch": false,
    "survey_enabled": false,
    "become_enabled": false,
    "diff_mode": false,
    "allow_simultaneous": false,
    "custom_virtualenv": null,
    "credential": 1,
    "vault_credential": null
}`)

	// MockedUpdateJobTemplateResponse mocked `UpdateJobTemplate` endpoint response
	MockedUpdateJobTemplateResponse = []byte(`
        {
            "id": 5,
            "type": "job_template",
            "url": "/api/v2/job_templates/5/",
            "related": {
                "named_url": "/api/v2/job_templates/Demo Job Template/",
                "created_by": "/api/v2/users/1/",
                "modified_by": "/api/v2/users/1/",
                "labels": "/api/v2/job_templates/5/labels/",
                "inventory": "/api/v2/inventories/1/",
                "project": "/api/v2/projects/4/",
                "credential": "/api/v2/credentials/1/",
                "extra_credentials": "/api/v2/job_templates/5/extra_credentials/",
                "credentials": "/api/v2/job_templates/5/credentials/",
                "notification_templates_error": "/api/v2/job_templates/5/notification_templates_error/",
                "notification_templates_success": "/api/v2/job_templates/5/notification_templates_success/",
                "jobs": "/api/v2/job_templates/5/jobs/",
                "object_roles": "/api/v2/job_templates/5/object_roles/",
                "notification_templates_any": "/api/v2/job_templates/5/notification_templates_any/",
                "access_list": "/api/v2/job_templates/5/access_list/",
                "launch": "/api/v2/job_templates/5/launch/",
                "instance_groups": "/api/v2/job_templates/5/instance_groups/",
                "schedules": "/api/v2/job_templates/5/schedules/",
                "copy": "/api/v2/job_templates/5/copy/",
                "activity_stream": "/api/v2/job_templates/5/activity_stream/",
                "survey_spec": "/api/v2/job_templates/5/survey_spec/"
            },
            "summary_fields": {
                "inventory": {
                    "id": 1,
                    "name": "Demo Inventory",
                    "description": "",
                    "has_active_failures": false,
                    "total_hosts": 2,
                    "hosts_with_active_failures": 0,
                    "total_groups": 0,
                    "groups_with_active_failures": 0,
                    "has_inventory_sources": false,
                    "total_inventory_sources": 0,
                    "inventory_sources_with_failures": 0,
                    "organization_id": 1,
                    "kind": ""
                },
                "project": {
                    "id": 4,
                    "name": "Demo Project",
                    "description": "",
                    "status": "never updated",
                    "scm_type": "git"
                },
                "created_by": {
                    "id": 1,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "modified_by": {
                    "id": 1,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "object_roles": {
                    "admin_role": {
                        "id": 28,
                        "description": "Can manage all aspects of the job template",
                        "name": "Admin"
                    },
                    "execute_role": {
                        "id": 27,
                        "description": "May run the job template",
                        "name": "Execute"
                    },
                    "read_role": {
                        "id": 26,
                        "description": "May view settings for the job template",
                        "name": "Read"
                    }
                },
                "user_capabilities": {
                    "edit": true,
                    "start": true,
                    "copy": true,
                    "schedule": true,
                    "delete": true
                },
                "labels": {
                    "count": 0,
                    "results": []
                },
                "recent_jobs": [],
                "extra_credentials": [],
                "credentials": [
                    {
                        "description": "",
                        "credential_type_id": 1,
                        "id": 1,
                        "kind": "ssh",
                        "name": "Demo Credential"
                    }
                ]
            },
            "created": "2018-06-28T16:31:16.238510Z",
            "modified": "2018-06-28T16:31:16.238524Z",
            "name": "Demo Job Template",
            "description": "Test Update",
            "job_type": "run",
            "inventory": 1,
            "project": 4,
            "playbook": "hello_world.yml",
            "forks": 0,
            "limit": "",
            "verbosity": 0,
            "extra_vars": "",
            "job_tags": "",
            "force_handlers": false,
            "skip_tags": "",
            "start_at_task": "",
            "timeout": 0,
            "use_fact_cache": false,
            "last_job_run": null,
            "last_job_failed": false,
            "next_job_run": null,
            "status": "never updated",
            "host_config_key": "",
            "ask_diff_mode_on_launch": false,
            "ask_variables_on_launch": false,
            "ask_limit_on_launch": false,
            "ask_tags_on_launch": false,
            "ask_skip_tags_on_launch": false,
            "ask_job_type_on_launch": false,
            "ask_verbosity_on_launch": false,
            "ask_inventory_on_launch": false,
            "ask_credential_on_launch": false,
            "survey_enabled": false,
            "become_enabled": false,
            "diff_mode": false,
            "allow_simultaneous": false,
            "custom_virtualenv": null,
            "credential": 1,
            "vault_credential": null
        }`)

	// MockedDeleteJobTemplateResponse mocked `DeleteJobTemplate` endpoint response
	MockedDeleteJobTemplateResponse = []byte(`{}`)
)
View Source
var (
	// MockedProjectUpdateCancelResponse mocked `ProjectUpdateCancel` endpoint response
	MockedProjectUpdateCancelResponse = []byte(`{
        "can_cancel": true
    }`)

	// MockedProjectUpdateGetResponse mocked `ProjectUpdateGet` endpoint response
	MockedProjectUpdateGetResponse = []byte(`
        {
            "id": 301,
            "type": "job",
            "url": "/api/v2/jobs/301/",
            "related": {
                "created_by": "/api/v2/users/1/",
                "labels": "/api/v2/jobs/301/labels/",
                "inventory": "/api/v2/inventories/1/",
                "project": "/api/v2/projects/6/",
                "extra_credentials": "/api/v2/jobs/301/extra_credentials/",
                "credentials": "/api/v2/jobs/301/credentials/",
                "unified_job_template": "/api/v2/job_templates/8/",
                "stdout": "/api/v2/jobs/301/stdout/",
                "notifications": "/api/v2/jobs/301/notifications/",
                "job_host_summaries": "/api/v2/jobs/301/job_host_summaries/",
                "job_events": "/api/v2/jobs/301/job_events/",
                "activity_stream": "/api/v2/jobs/301/activity_stream/",
                "job_template": "/api/v2/job_templates/8/",
                "cancel": "/api/v2/jobs/301/cancel/",
                "project_update": "/api/v2/project_updates/303/",
                "create_schedule": "/api/v2/jobs/301/create_schedule/",
                "relaunch": "/api/v2/jobs/301/relaunch/"
            },
            "summary_fields": {
                "instance_group": {
                    "id": 1,
                    "name": "tower"
                },
                "job_template": {
                    "id": 8,
                    "name": "Hello-world",
                    "description": ""
                },
                "inventory": {
                    "id": 1,
                    "name": "Demo Inventory",
                    "description": "",
                    "has_active_failures": false,
                    "total_hosts": 2,
                    "hosts_with_active_failures": 0,
                    "total_groups": 0,
                    "groups_with_active_failures": 0,
                    "has_inventory_sources": false,
                    "total_inventory_sources": 0,
                    "inventory_sources_with_failures": 0,
                    "organization_id": 1,
                    "kind": ""
                },
                "project_update": {
                    "id": 303,
                    "name": "DeployBook",
                    "description": "",
                    "status": "successful",
                    "failed": false
                },
                "unified_job_template": {
                    "id": 8,
                    "name": "Hello-world",
                    "description": "",
                    "unified_job_type": "job"
                },
                "project": {
                    "id": 6,
                    "name": "DeployBook",
                    "description": "",
                    "status": "successful",
                    "scm_type": "git"
                },
                "created_by": {
                    "id": 1,
                    "username": "admin",
                    "first_name": "",
                    "last_name": ""
                },
                "user_capabilities": {
                    "start": true,
                    "delete": true
                },
                "labels": {
                    "count": 0,
                    "results": []
                },
                "extra_credentials": [],
                "credentials": []
            },
            "created": "2018-06-05T09:13:43.046077Z",
            "modified": "2018-06-05T09:13:49.132905Z",
            "name": "Hello-world",
            "description": "",
            "job_type": "run",
            "inventory": 1,
            "project": 6,
            "playbook": "hello-world.yml",
            "forks": 0,
            "limit": "localhost",
            "verbosity": 0,
            "extra_vars": "{}",
            "job_tags": "",
            "force_handlers": false,
            "skip_tags": "",
            "start_at_task": "",
            "timeout": 0,
            "use_fact_cache": false,
            "unified_job_template": 8,
            "launch_type": "manual",
            "status": "canceled",
            "failed": true,
            "started": "2018-06-05T09:13:47.060276Z",
            "finished": "2018-06-05T09:13:54.740342Z",
            "elapsed": 7.68,
            "job_args": "[\"ansible-playbook\", \"-i\", \"/tmp/awx_301_3kuP6Z/tmpupf88B\", \"-u\", \"root\", \"-l\", \"localhost\", \"-e\", \"@/tmp/awx_301_3kuP6Z/tmpjlw9Dp\", \"hello-world.yml\"]",
            "job_cwd": "/var/lib/awx/projects/_6__deploybook",
            "job_env": {},
            "job_explanation": "",
            "execution_node": "awx",
            "result_traceback": "",
            "event_processing_finished": true,
            "job_template": 8,
            "passwords_needed_to_start": [],
            "ask_diff_mode_on_launch": false,
            "ask_variables_on_launch": true,
            "ask_limit_on_launch": true,
            "ask_tags_on_launch": false,
            "ask_skip_tags_on_launch": false,
            "ask_job_type_on_launch": false,
            "ask_verbosity_on_launch": false,
            "ask_inventory_on_launch": true,
            "ask_credential_on_launch": false,
            "allow_simultaneous": false,
            "artifacts": {},
            "scm_revision": "ae9cc6b0fee9aea55e10a4a325c9ae3d97c42f1a",
            "instance_group": 1,
            "diff_mode": false,
            "credential": null,
            "vault_credential": null
        }`)
)
View Source
var (
	// MockedListProjectsResponse mocked `ListProjects` endpoint response
	MockedListProjectsResponse = []byte(`
    {
        "count": 1,
        "next": null,
        "previous": null,
        "results": [{
            "id": 4,
            "type": "project",
            "url": "/api/v2/projects/4/",
            "related": {
                "created_by": "/api/v2/users/1/",
                "modified_by": "/api/v2/users/1/",
                "object_roles": "/api/v2/projects/4/object_roles/",
                "copy": "/api/v2/projects/4/copy/",
                "access_list": "/api/v2/projects/4/access_list/",
                "schedules": "/api/v2/projects/4/schedules/",
                "organization": "/api/v2/organizations/1/"
            },
            "summary_fields": {
                "organization": {
                    "id": 1,
                    "name": "Default",
                    "description": ""
                },
                "created_by": {
                    "id": 1,
                    "username": "admin",
                    "first_name": "admin",
                    "last_name": "admin"
                },
                "modified_by": {
                    "id": 1,
                    "username": "admin",
                    "first_name": "admin",
                    "last_name": "admin"
                },
                "object_roles": {
                    "admin_role": {
                        "id": 14,
                        "description": "Can manage all aspects of the project",
                        "name": "Admin"
                    },
                    "use_role": {
                        "id": 16,
                        "description": "Can manage all aspects of the project",
                        "name": "Use"
                    },
                    "update_role": {
                        "id": 17,
                        "description": "May update project or inventory or group using the configured source update system",
                        "name": "Update"
                    },
                    "read_role": {
                        "id": 15,
                        "description": "May view settings for the project",
                        "name": "Read"
                    }
                },
                "user_capabilities": {
                    "edit": true,
                    "start": true,
                    "copy": true,
                    "schedule": true,
                    "delete": true
                }
            },
            "created": "2018-06-28T16:31:15.809617Z",
            "modified": "2018-06-28T16:31:15.923732Z",
            "name": "Demo Project",
            "description": "",
            "local_path": "",
            "scm_type": "git",
            "scm_url": "https://github.com/ansible/ansible-tower-samples",
            "scm_clean": false,
            "scm_delete_on_update": false,
            "status": "never updated",
            "scm_delete_on_next_update": false,
            "scm_update_on_launch": true,
            "scm_update_cache_timeout": 0,
            "last_update_failed": false
        }]
    }`)

	// MockedCreateProjectResponse mocked `CreateProject` endpoint response
	MockedCreateProjectResponse = []byte(`
    {
        "id": 4,
        "type": "project",
        "url": "/api/v2/projects/4/",
        "related": {
            "created_by": "/api/v2/users/1/",
            "modified_by": "/api/v2/users/1/",
            "object_roles": "/api/v2/projects/4/object_roles/",
            "copy": "/api/v2/projects/4/copy/",
            "access_list": "/api/v2/projects/4/access_list/",
            "schedules": "/api/v2/projects/4/schedules/",
            "organization": "/api/v2/organizations/1/"
        },
        "summary_fields": {
            "organization": {
                "id": 1,
                "name": "Default",
                "description": ""
            },
            "created_by": {
                "id": 1,
                "username": "admin",
                "first_name": "admin",
                "last_name": "admin"
            },
            "modified_by": {
                "id": 1,
                "username": "admin",
                "first_name": "admin",
                "last_name": "admin"
            },
            "object_roles": {
                "admin_role": {
                    "id": 14,
                    "description": "Can manage all aspects of the project",
                    "name": "Admin"
                },
                "use_role": {
                    "id": 16,
                    "description": "Can manage all aspects of the project",
                    "name": "Use"
                },
                "update_role": {
                    "id": 17,
                    "description": "May update project or inventory or group using the configured source update system",
                    "name": "Update"
                },
                "read_role": {
                    "id": 15,
                    "description": "May view settings for the project",
                    "name": "Read"
                }
            },
            "user_capabilities": {
                "edit": true,
                "start": true,
                "copy": true,
                "schedule": true,
                "delete": true
            }
        },
        "created": "2018-06-28T16:31:15.809617Z",
        "modified": "2018-06-28T16:31:15.923732Z",
        "name": "Demo Project",
        "description": "",
        "local_path": "",
        "scm_type": "git",
        "scm_url": "https://github.com/ansible/ansible-tower-samples",
        "scm_clean": false,
        "scm_delete_on_update": false,
        "status": "never updated",
        "scm_delete_on_next_update": false,
        "scm_update_on_launch": true,
        "scm_update_cache_timeout": 0,
        "last_update_failed": false
    }`)
	// MockedUpdateProjectResponse mocked `UpdateProject` endpoint response
	MockedUpdateProjectResponse = []byte(`
    {
        "id": 4,
        "type": "project",
        "url": "/api/v2/projects/4/",
        "related": {
            "created_by": "/api/v2/users/1/",
            "modified_by": "/api/v2/users/1/",
            "object_roles": "/api/v2/projects/4/object_roles/",
            "copy": "/api/v2/projects/4/copy/",
            "access_list": "/api/v2/projects/4/access_list/",
            "schedules": "/api/v2/projects/4/schedules/",
            "organization": "/api/v2/organizations/1/"
        },
        "summary_fields": {
            "organization": {
                "id": 1,
                "name": "Default",
                "description": ""
            },
            "created_by": {
                "id": 1,
                "username": "admin",
                "first_name": "admin",
                "last_name": "admin"
            },
            "modified_by": {
                "id": 1,
                "username": "admin",
                "first_name": "admin",
                "last_name": "admin"
            },
            "object_roles": {
                "admin_role": {
                    "id": 14,
                    "description": "Can manage all aspects of the project",
                    "name": "Admin"
                },
                "use_role": {
                    "id": 16,
                    "description": "Can manage all aspects of the project",
                    "name": "Use"
                },
                "update_role": {
                    "id": 17,
                    "description": "May update project or inventory or group using the configured source update system",
                    "name": "Update"
                },
                "read_role": {
                    "id": 15,
                    "description": "May view settings for the project",
                    "name": "Read"
                }
            },
            "user_capabilities": {
                "edit": true,
                "start": true,
                "copy": true,
                "schedule": true,
                "delete": true
            }
        },
        "created": "2018-06-28T16:31:15.809617Z",
        "modified": "2018-06-28T16:31:15.923732Z",
        "name": "Demo Project",
        "description": "Test Update",
        "local_path": "",
        "scm_type": "git",
        "scm_url": "https://github.com/ansible/ansible-tower-samples",
        "scm_clean": false,
        "scm_delete_on_update": false,
        "status": "never updated",
        "scm_delete_on_next_update": false,
        "scm_update_on_launch": true,
        "scm_update_cache_timeout": 0,
        "last_update_failed": false
    }`)

	// MockedDeleteProjectResponse mocked `DeleteProject` endpoint response
	MockedDeleteProjectResponse = []byte(`{}`)
)
View Source
var (
	// MockedListUsersResponse mocked `ListUsers` endpoint response
	MockedListUsersResponse = []byte(`
    {
        "count": 1,
        "next": null,
        "previous": null,
        "results": [
            {
                "id": 1,
                "type": "user",
                "url": "/api/v2/users/1/",
                "related": {
                    "admin_of_organizations": "/api/v2/users/1/admin_of_organizations/",
                    "organizations": "/api/v2/users/1/organizations/",
                    "roles": "/api/v2/users/1/roles/",
                    "access_list": "/api/v2/users/1/access_list/",
                    "teams": "/api/v2/users/1/teams/",
                    "credentials": "/api/v2/users/1/credentials/",
                    "activity_stream": "/api/v2/users/1/activity_stream/",
                    "projects": "/api/v2/users/1/projects/"
                },
                "summary_fields": {
                    "user_capabilities": {
                        "edit": true,
                        "delete": true
                    }
                },
                "created": "2017-09-06T02:55:30.492Z",
                "username": "admin",
                "first_name": "",
                "last_name": "",
                "email": "admin@example.com",
                "is_superuser": true,
                "is_system_auditor": false,
                "ldap_dn": "",
                "external_account": null
            }
        ]
    }`)

	// MockedCreateUserResponse mocked `CreateUser` endpoint response
	MockedCreateUserResponse = []byte(`
    {
        "id": 1,
        "type": "user",
        "url": "/api/v2/users/1/",
        "related": {
            "admin_of_organizations": "/api/v2/users/1/admin_of_organizations/",
            "organizations": "/api/v2/users/1/organizations/",
            "roles": "/api/v2/users/1/roles/",
            "access_list": "/api/v2/users/1/access_list/",
            "teams": "/api/v2/users/1/teams/",
            "credentials": "/api/v2/users/1/credentials/",
            "activity_stream": "/api/v2/users/1/activity_stream/",
            "projects": "/api/v2/users/1/projects/"
        },
        "summary_fields": {
            "user_capabilities": {
                "edit": true,
                "delete": true
            }
        },
        "created": "2017-09-06T02:55:30.492Z",
        "username": "admin",
        "first_name": "",
        "last_name": "",
        "email": "admin@example.com",
        "is_superuser": true,
        "is_system_auditor": false,
        "ldap_dn": "",
        "external_account": null
    }`)

	// MockedUpdateUserResponse mocked `UpdateUser` endpoint response
	MockedUpdateUserResponse = []byte(`
        {
            "id": 1,
            "type": "user",
            "url": "/api/v2/users/1/",
            "related": {
                "admin_of_organizations": "/api/v2/users/1/admin_of_organizations/",
                "organizations": "/api/v2/users/1/organizations/",
                "roles": "/api/v2/users/1/roles/",
                "access_list": "/api/v2/users/1/access_list/",
                "teams": "/api/v2/users/1/teams/",
                "credentials": "/api/v2/users/1/credentials/",
                "activity_stream": "/api/v2/users/1/activity_stream/",
                "projects": "/api/v2/users/1/projects/"
            },
            "summary_fields": {
                "user_capabilities": {
                    "edit": true,
                    "delete": true
                }
            },
            "created": "2017-09-06T02:55:30.492Z",
            "username": "admin",
            "first_name": "",
            "last_name": "",
            "email": "admin@example.net",
            "is_superuser": true,
            "is_system_auditor": false,
            "ldap_dn": "",
            "external_account": null
        }`)

	// MockedDeleteUserResponse mocked `DeleteUser` endpoint response
	MockedDeleteUserResponse = []byte(`{ }`)
)
View Source
var (
	// MockedPingResponse mocked `Ping` endpoint response
	MockedPingResponse = []byte(`
{
    "instance_groups": [
        {
            "instances": [
                "awx"
            ],
            "capacity": 138,
            "name": "tower"
        }
    ],
    "instances": [
        {
            "node": "awx",
            "heartbeat": "2018-06-25T03:14:34.688447Z",
            "version": "1.0.6.5",
            "capacity": 138
        }
    ],
    "ha": false,
    "version": "1.0.6.5",
    "active_node": "awx"
}`)
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL