1

I'm working on a simple webservice in django. This is my first web app in django/python so I wouldn't be surprised if I'm missing something obvious here, but...

I'm currently trying to test my logic for filtering a url.

            # Works as expected
            response = self.client.post("/mysite/goodurl/")
            self.assertEqual(response.status_code, 200)

            # Has an exception rather than a 404
            response = self.client.post("/mysite/badurl/")
            self.assertEqual(response.status_code, 404)

So, the badurl case isn't simply being not found and throwing a 404, instead I'm getting this error:

Traceback (most recent call last):
  File "/home/user/me/mysite/tests.py", line 55, in test_add_tracker
    response = self.client.post("/mysite/badurl/")
  File "/home/path/to/some/bin/dir/freeware/Python/lib/python2.7/site-packages/django/test/client.py", line 449, in post
    response = super(Client, self).post(path, data=data, content_type=content_type, **extra)
  File "/home/path/to/some/bin/dir/freeware/Python/lib/python2.7/site-packages/django/test/client.py", line 262, in post
    return self.request(**r)
  File "/home/path/to/some/bin/dir/freeware/Python/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/home/path/to/some/bin/dir/freeware/Python/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 77, in wrapped_view
    return view_func(*args, **kwargs)
TypeError: EtimeFetcher() got an unexpected keyword argument 'alias'

I've tried googling for the EtimeFetcher message, but no luck. Any ideas?

3
  • Do you have some view to catch all Http404 errors? It seems that Django however had found a view to execute for the badurl. Search in your code for statements containing the alias named parameter, like: "alias=yyyy". Or probably some url pattern, contaning 'alias' as extra parameter in urls.py ?
    – Tisho
    Jun 11, 2012 at 12:31
  • @Tisho - you were right. Please put your comment as an answer so I can upvote/accept. Basically, I had a url mapped to a view I hadn't written yet. When the request handler was trying to go through all of the views on the url list, it went to the one I had yet to write...and boom!
    – Dave
    Jun 11, 2012 at 19:48
  • Nice to hear that it helps :)
    – Tisho
    Jun 11, 2012 at 20:22

1 Answer 1

1

Uou may probably have some view to catch all Http404 errors. It seems that Django however had found a view to execute for the /badurl. Search in your code for statements containing the alias named parameter, like: "alias=yyyy". Or probably some url pattern, contaning 'alias' as extra parameter in urls.py?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.