@@ -0,0 +1,1214 @@
+import model%0Afrom app import app%0Aimport unittest%0Aimport tempfile%0Aimport hashlib%0Afrom StringIO import StringIO%0Aimport os%0A%0Aclass UploadTestCase(unittest.TestCase):%0A    def setUp(self):%0A        app.config%5B'UPLOAD_PATH'%5D = tempfile.mkdtemp()%0A        self.app = app.test_client()%0A        self.app.post('/index', data=%7B'body': '', 'message': ''%7D)%0A%0A    def test_empty_upload(self):%0A      self.app.post('/index/attach', data=%7B%0A        'file': (StringIO(''), 'empty.txt')%0A      %7D)%0A      sha = hashlib.sha256()%0A      sha.update('')%0A      emptySha = sha.hexdigest()%0A      uploadedFile = os.path.join(app.config%5B'UPLOAD_PATH'%5D,%0A        emptySha+'-empty.txt')%0A%0A      self.assertTrue(os.path.exists(uploadedFile))%0A      self.assertEqual(self.app.get('/index/file/empty_txt').data, '')%0A%0A    def test_simple_upload(self):%0A      self.app.post('/index/attach', data=%7B%0A        'file': (StringIO('FOOBAR'), 'foo.bar')%0A      %7D)%0A      sha = hashlib.sha256()%0A      sha.update('FOOBAR')%0A      emptySha = sha.hexdigest()%0A      uploadedFile = os.path.join(app.config%5B'UPLOAD_PATH'%5D,%0A        emptySha+'-foo.bar')%0A%0A      self.assertTrue(os.path.exists(uploadedFile))%0A      self.assertEqual(self.app.get('/index/file/foo_bar').data, 'FOOBAR')%0A

Test uploads