samedi 20 juin 2015

NoReverseMatch: Reverse for 'home' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

I do not have any view name called home in my app. I've verified all other third party apps I use, NONE of them have a 'home' in their url conf.

Yet, this line of code in my tests.py spits out the error in the title (see code comments): See Full traceback too

# the test section where error comes
def test_add_item_with_login(self):
    ''' See if will post if user login'''
    self._create_user_and_login()

    response = self.client.post(reverse('add'), self.post_data)
    print response
    # this above line give me:
    # ..Vary: Cookie
    # X-Frame-Options: SAMEORIGIN
    # Content-Type: text/html; charset=utf-8
    # Location: http://testserver/detail/00000/

    self.assertEqual(response.status_code, 302)
    # this line above doesn't fail, kinda ambiguous
    # if post succeeded, and redirected to location above, I expect it to fail because new page should give 200?

    print resolve('/detail/00000/')
    # the above gives: 
    # ResolverMatch(func=main.views.imei_detail, args=(), kwargs={'slug': u'00000'}, url_name=detail, app_name=None, namespaces=[])

    # the next line is the referenced point of the error
    response = self.client.get('/detail/00000/')

again, I do not have any part in any urlconf in my entire project with even the word 'home' in it.

I've gone through my templates, .html by .html (along with their includes) and none has a reference to a url called 'home'

Thus, where is the 'home' coming from? Is the test suite using a urlconf I don't know of?

Aucun commentaire:

Enregistrer un commentaire