#################################################################
#Copyright (C) 2003 Chris Curvey
#
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
#################################################################

import unittest
import HtmlTestCase

class FileUploadTest(HtmlTestCase.HtmlTestCase):
    def testFileUpload(self):
        self.get("http://localhost:8000/fileTest.html")
	forms = self.findForms()
	assert len(forms) == 1
	form = forms[0]

	myfile = form.find_control("myfile")
	myfile = "/home/chris/mary.txt"

        self.submitForm(form.click())
	#self.showInBrowser()

    def testRealFolder(self):
        self.get("http://localhost:8000/CreateWorkorder.html")
	forms = self.findForms()
	
	myfile = forms[0].find_control("file")
	myfile = "/home/chris/mary.txt"

        request = forms[0].click()
	#print forms[0].enctype
	#print request
	self.submitForm(request)
	self.showInBrowser()

if __name__ == "__main__":
    unittest.main(defaultTest="FileUploadTest.testRealFolder")
    #unittest.main()

