I'm suggesting a test that uses the call_command() function to run the
command using one of the test projects' apps as input.

Sorta like how django has tests for the inspectdb command (
https://github.com/django/django/blob/master/tests/inspectdb/tests.py).

On Sat, Dec 7, 2013 at 6:00 PM, sesas <notifications@github.com> wrote:

> In tastypie/management/commands/describe_api.py:
>
> > +
> > +class Command(AppCommand):
> > +    help = "Generates tastypie resources for the given app that you should put in APP/api.py."
> > +    args = "[appname]"
> > +    label = "application name"
> > +
> > +    def handle_app(self, app, **options):
> > +        # raise NotImplementedError()
> > +        return describe_api(app)
> > +
> > +
> > +FIELD_TEMPLATE = "{attribute_name} = fields.ForeignKey('{app_name}.api.{foreign_model}', '{attribute_name}'{options_str})"
> > +RESOURCE_POSTFIX = 'Resource'
> > +
> > +
> > +def describe_api(app, **options):
>
> So are you suggesting that I should pick one of those sample apps (say
> basic) run the main function on it's app, write the output of that
> function to a file called api.py and then run some GET, POST, PUT, and
> DELETE http requests to it?
>
> Maybe I should copy the test/basic to test/describe_api first, delete the
> current api/resources.py and modify the api/urls.py then.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/toastdriven/django-tastypie/pull/1092/files#r8183568>
> .
>