'Test case for #1439. Need to handle schemas for related resources that
aren\'t in any urlconfs.'

def test_get_schema_with_related_resource_not_in_urls(self):

    class GhostResource(Resource, ):
        foo = fields.CharField()
        class Meta:
            object_class = object
    class CustomRelatedNoteResource(RelatedNoteResource, ):
        ghost = fields.ToOneField(GhostResource, u'ghost')
        Meta = RelatedNoteResource.Meta
    resource = CustomRelatedNoteResource()
    request = HttpRequest()
    request.GET = {u'format': u'json'}
    request.method = u'GET'
    with patch.object(resource.fields[u'created'], u'_default', new=aware_datetime(2011, 9, 24, 0, 2)):
        resp = resource.get_schema(request)
    self.assertEqual(resp.status_code, 200)
    expected_schema = {u'allowed_detail_http_methods': [u'get', u'post', u'put', u'delete', u'patch'], u'allowed_list_http_methods': [u'get', u'post', u'put', u'delete', u'patch'], u'default_format': u'application/json', u'default_limit': 20, u'fields': {u'content': {u'blank': True, u'default': u'', u'help_text': u'Unicode    string    data.    Ex:    "Hello    World"', u'verbose_name': u'content', u'nullable': False, u'readonly': False, u'type': u'string', u'unique': False, u'primary_key': False}, u'created': {u'blank': False, u'default': u'2011-09-24T00:02:00', u'help_text': u'A    date    &    time    as    a    string.    Ex:    "2010-11-10T03:07:43"', u'verbose_name': u'created', u'nullable': False, u'readonly': False, u'type': u'datetime', u'unique': False, u'primary_key': False}, u'is_active': {u'blank': True, u'default': True, u'help_text': u'Boolean    data.    Ex:    True', u'verbose_name': u'is    active', u'nullable': False, u'readonly': False, u'type': u'boolean', u'unique': False, u'primary_key': False}, u'resource_uri': {u'blank': False, u'default': u'No    default    provided.', u'help_text': u'Unicode    string    data.    Ex:    "Hello    World"', u'verbose_name': u'resource    uri', u'nullable': False, u'readonly': True, u'type': u'string', u'unique': False, u'primary_key': False}, u'slug': {u'blank': False, u'default': u'No    default    provided.', u'help_text': u'Unicode    string    data.    Ex:    "Hello    World"', u'verbose_name': u'slug', u'nullable': False, u'readonly': False, u'type': u'string', u'unique': False, u'primary_key': False}, u'title': {u'blank': False, u'default': u'No    default    provided.', u'help_text': u'Unicode    string    data.    Ex:    "Hello    World"', u'verbose_name': u'The    Title', u'nullable': False, u'readonly': False, u'type': u'string', u'unique': False, u'primary_key': False}, u'ghost': {u'blank': False, u'default': u'No    default    provided.', u'help_text': u'A    single    related    resource.    Can    be    either    a    URI    or    set    of    nested    resource    data.', u'verbose_name': u'ghost', u'readonly': False, u'nullable': False, u'type': u'related', u'unique': False, u'primary_key': False, u'related_schema': u'', u'related_type': u'to_one'}}, u'default_format': u'application/json', u'filtering': {u'author': ALL, u'subjects': ALL_WITH_RELATIONS}}
    schema = json.loads(resp.content.decode(u'utf-8'))
    self.assertEqual(schema[u'fields'], expected_schema[u'fields'])
