c259dea73a80dbc62c007de69a4597a6e82a916c,django/comicsite/tests.py,UploadTest,_upload_test_file,#UploadTest#Any#Any#,378

Before Change


        request.user = user
        
        import StringIO
        fakefile = StringIO.StringIO()
        fakefile.write("some uploaded content" + testfilename)
        
        request.FILES["file"] = SimpleUploadedFile(name=testfilename,
                                                   content=fakefile.read())

After Change


        
                
        
        testfilename = user.username.encode("ascii","ignore") + "_testfile.txt"
        url = reverse("comicmodels.views.upload_handler", 
            kwargs={"site_short_name":self.testproject.short_name})
        factory = RequestFactory()
        request = factory.get(url)
        request.user = user
        
        import StringIO
        fakefile = File(StringIO.StringIO("some uploaded content for" + testfilename))
        
        fakecontent = "some uploaded content for" + testfilename
        request.FILES["file"] = SimpleUploadedFile(name=testfilename,
                                                   content=fakecontent)
        
        request.method = "POST"
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: comic/grand-challenge.org
Commit Name: c259dea73a80dbc62c007de69a4597a6e82a916c
Time: 2013-07-12
Author: w.s.kerkstra@gmail.com
File Name: django/comicsite/tests.py
Class Name: UploadTest
Method Name: _upload_test_file


Project Name: comic/grand-challenge.org
Commit Name: 8d715ce57c9c358ce198ca98d8a87788a7d2c6ed
Time: 2013-07-12
Author: w.s.kerkstra@gmail.com
File Name: django/comicsite/tests.py
Class Name: UploadTest
Method Name: _upload_test_file


Project Name: matplotlib/matplotlib
Commit Name: 39fb7b5b96ea46aca94099d166106365eaf0647e
Time: 2018-03-08
Author: anntzer.lee@gmail.com
File Name: lib/matplotlib/tests/test_backend_ps.py
Class Name:
Method Name: test_savefig_to_stringio


Project Name: tensorflow/datasets
Commit Name: c1d5d469f7107a5a395c7915c0eff1696ebda7bb
Time: 2020-05-15
Author: epot@google.com
File Name: tensorflow_datasets/testing/test_utils.py
Class Name: MockFs
Method Name: _open