mercredi 13 janvier 2016

Django tests Get created object against client.post()

I have created a test which which would sent a post request to a url and the method called against that request makes few objects, my question is how do i get these created objects ?

def test_post(self):
    response = self.c.post('/url/', {'name' : 'postname', 'content' : 'abc'})

while my view logic looks something like

Class MakePost():
  def makePost(self, request, data):
     object = Class()
     object2 = AnotherClass()
     return object
  def get_success_url(self, request, user):
     return '/post/'

Aucun commentaire:

Enregistrer un commentaire