views:

136

answers:

2

I just built a small application(using Django) which will accept any jobseeker resumes. So any jobseeker uploads his/her resume in the form provided. How do I test this using testcases. I am used to writing fixtures for my initial data using json files. How would I have the same sort of a thing with doc files? So simply I want to run my testcases on a different set of resumes. How can I achieve this with minimum complexity.

A: 

you can try django fake file uploads

Badri
A: 

Ofcourse this is a work around I came up with. I place all my .doc files in the /fixtures/ directory and manually open them and read them. like:

Class MyTests(TestCase):

    def setUp(self):
        from django.test.client import Client
        self.client = Client()
        self.file = open(settings.FILES + 'somefile.doc', 'rb')

    def test_someusecase(self):
        signup_data = {'fname':"Alexander", 'email':'[email protected]', 'file':self.file}
        response = self.client.post(path='/signup/', data=signup_data)

So its just an alternative way to get my stuff done. I am sure its not a best solution. If anybody find one! let me know.

Maddy