'Creates OsContract for deleteServerGroup.
To verify the operation, we just check that the spinnaker security group
for the given application was deleted.'

def delete_a_security_group(self):

    os_agent = os.OsAgent(None)
    data = os_agent.get_resource('security    group', self.TEST_SECURITY_GROUP)
    security_group_id = data['id']
    payload = self.agent.make_json_payload_from_kwargs(job=[{'Provider': 'openstack', 'id': security_group_id, 'region': self.bindings['OS_REGION_NAME'], 'regions': [self.bindings['OS_REGION_NAME']], 'account': self.bindings['SPINNAKER_OS_ACCOUNT'], 'securityGroupName': self.TEST_SECURITY_GROUP, 'cloudProvider': 'openstack', 'type': 'deleteSecurityGroup', 'user': self.bindings['TEST_OS_USERNAME']}], application=self.TEST_APP, description=('Delete    Security    Group:    :    ' + self.TEST_SECURITY_GROUP))
    builder = os.OsContractBuilder(self.os_observer)
    builder.new_clause_builder('Security    Group    Deleted', retryable_for_secs=30).show_resource('security    group', self.TEST_SECURITY_GROUP, no_resources_ok=True).excludes_path_eq('name', self.TEST_SECURITY_GROUP)
    return st.OperationContract(self.new_post_operation(title='delete_security_group', data=payload, path='applications/{app}/tasks'.format(app=self.TEST_APP)), contract=builder.build())
