Changeset 2cb0581 in trunk
- Timestamp:
- 2007-12-12T02:47:04Z (17 years ago)
- Branches:
- master
- Children:
- 38d1af7
- Parents:
- b085097
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/allmydata/test/test_web.py ¶
rb085097 r2cb0581 445 445 446 446 def test_GET_FILEURL_localfile(self): 447 localfile = os.path.abspath("web/GET_FILEURL_localfile") 448 url = self.public_url + "/foo/bar.txt?t=download&localfile=%s" % localfile 447 localfile = os.path.abspath("web/GET_FILEURL_local file") 448 url = (self.public_url + "/foo/bar.txt?t=download&localfile=%s" % 449 urllib.quote(localfile)) 449 450 fileutil.make_dirs("web") 450 451 d = self.GET(url) … … 457 458 458 459 def test_GET_FILEURL_localfile_disabled(self): 459 localfile = os.path.abspath("web/GET_FILEURL_localfile_disabled") 460 url = self.public_url + "/foo/bar.txt?t=download&localfile=%s" % localfile 460 localfile = os.path.abspath("web/GET_FILEURL_local file_disabled") 461 url = (self.public_url + "/foo/bar.txt?t=download&localfile=%s" % 462 urllib.quote(localfile)) 461 463 fileutil.make_dirs("web") 462 464 self.disable_local_access() … … 473 475 old_LOCALHOST = webish.LOCALHOST 474 476 webish.LOCALHOST = "127.0.0.2" 475 localfile = os.path.abspath("web/GET_FILEURL_local file_nonlocal")477 localfile = os.path.abspath("web/GET_FILEURL_local file_nonlocal") 476 478 fileutil.make_dirs("web") 477 479 d = self.GET(self.public_url + "/foo/bar.txt?t=download&localfile=%s" 478 % localfile)480 % urllib.quote(localfile)) 479 481 d.addBoth(self.shouldFail, error.Error, "localfile non-local", 480 482 "403 Forbidden", … … 493 495 fileutil.make_dirs("web/nonabsolute") 494 496 d = self.GET(self.public_url + "/foo/bar.txt?t=download&localfile=%s" 495 % localfile)497 % urllib.quote(localfile)) 496 498 d.addBoth(self.shouldFail, error.Error, "localfile non-absolute", 497 499 "403 Forbidden", … … 503 505 504 506 def test_PUT_NEWFILEURL_localfile(self): 505 localfile = os.path.abspath("web/PUT_NEWFILEURL_localfile") 506 url = self.public_url + "/foo/new.txt?t=upload&localfile=%s" % localfile 507 localfile = os.path.abspath("web/PUT_NEWFILEURL_local file") 508 url = (self.public_url + "/foo/new.txt?t=upload&localfile=%s" % 509 urllib.quote(localfile)) 507 510 fileutil.make_dirs("web") 508 511 f = open(localfile, "wb") … … 517 520 518 521 def test_PUT_NEWFILEURL_localfile_disabled(self): 519 localfile = os.path.abspath("web/PUT_NEWFILEURL_localfile_disabled") 520 url = self.public_url + "/foo/new.txt?t=upload&localfile=%s" % localfile 522 localfile = os.path.abspath("web/PUT_NEWFILEURL_local file_disabled") 523 url = (self.public_url + "/foo/new.txt?t=upload&localfile=%s" % 524 urllib.quote(localfile)) 521 525 fileutil.make_dirs("web") 522 526 f = open(localfile, "wb") … … 531 535 532 536 def test_PUT_NEWFILEURL_localfile_mkdirs(self): 533 localfile = os.path.abspath("web/PUT_NEWFILEURL_local file_mkdirs")537 localfile = os.path.abspath("web/PUT_NEWFILEURL_local file_mkdirs") 534 538 fileutil.make_dirs("web") 535 539 f = open(localfile, "wb") … … 537 541 f.close() 538 542 d = self.PUT(self.public_url + "/foo/newdir/new.txt?t=upload&localfile=%s" 539 % localfile, "")543 % urllib.quote(localfile), "") 540 544 d.addCallback(self.failUnlessURIMatchesChild, 541 545 self._foo_node, "newdir/new.txt") … … 715 719 716 720 def test_GET_DIRURL_localdir(self): 717 localdir = os.path.abspath("web/GET_DIRURL_local dir")721 localdir = os.path.abspath("web/GET_DIRURL_local dir") 718 722 fileutil.make_dirs("web") 719 d = self.GET(self.public_url + "/foo?t=download&localdir=%s" % localdir) 723 d = self.GET(self.public_url + "/foo?t=download&localdir=%s" % 724 urllib.quote(localdir)) 720 725 def _check(res): 721 726 barfile = os.path.join(localdir, "bar.txt") … … 731 736 732 737 def test_GET_DIRURL_localdir_disabled(self): 733 localdir = os.path.abspath("web/GET_DIRURL_local dir_disabled")738 localdir = os.path.abspath("web/GET_DIRURL_local dir_disabled") 734 739 fileutil.make_dirs("web") 735 740 self.disable_local_access() 736 d = self.GET(self.public_url + "/foo?t=download&localdir=%s" % localdir) 741 d = self.GET(self.public_url + "/foo?t=download&localdir=%s" % 742 urllib.quote(localdir)) 737 743 d.addBoth(self.shouldFail, error.Error, "localfile disabled", 738 744 "403 Forbidden", … … 741 747 742 748 def test_GET_DIRURL_localdir_nonabsolute(self): 743 localdir = "web/nonabsolute/dir path"749 localdir = "web/nonabsolute/dir path" 744 750 fileutil.make_dirs("web/nonabsolute") 745 d = self.GET(self.public_url + "/foo?t=download&localdir=%s" % localdir) 751 d = self.GET(self.public_url + "/foo?t=download&localdir=%s" % 752 urllib.quote(localdir)) 746 753 d.addBoth(self.shouldFail, error.Error, "localdir non-absolute", 747 754 "403 Forbidden", … … 811 818 812 819 def test_PUT_NEWDIRURL_localdir(self): 813 localdir = os.path.abspath("web/PUT_NEWDIRURL_local dir")820 localdir = os.path.abspath("web/PUT_NEWDIRURL_local dir") 814 821 # create some files there 815 822 fileutil.make_dirs(os.path.join(localdir, "one")) … … 822 829 823 830 d = self.PUT(self.public_url + "/newdir?t=upload&localdir=%s" 824 % localdir, "")831 % urllib.quote(localdir), "") 825 832 pr = self.public_root 826 833 d.addCallback(lambda res: self.failUnlessNodeHasChild(pr, "newdir")) … … 840 847 841 848 def test_PUT_NEWDIRURL_localdir_disabled(self): 842 localdir = os.path.abspath("web/PUT_NEWDIRURL_local dir_disabled")849 localdir = os.path.abspath("web/PUT_NEWDIRURL_local dir_disabled") 843 850 # create some files there 844 851 fileutil.make_dirs(os.path.join(localdir, "one")) … … 852 859 self.disable_local_access() 853 860 d = self.PUT(self.public_url + "/newdir?t=upload&localdir=%s" 854 % localdir, "")861 % urllib.quote(localdir), "") 855 862 d.addBoth(self.shouldFail, error.Error, "localfile disabled", 856 863 "403 Forbidden", … … 859 866 860 867 def test_PUT_NEWDIRURL_localdir_mkdirs(self): 861 localdir = os.path.abspath("web/PUT_NEWDIRURL_local dir_mkdirs")868 localdir = os.path.abspath("web/PUT_NEWDIRURL_local dir_mkdirs") 862 869 # create some files there 863 870 fileutil.make_dirs(os.path.join(localdir, "one")) … … 870 877 871 878 d = self.PUT(self.public_url + "/foo/subdir/newdir?t=upload&localdir=%s" 872 % localdir,879 % urllib.quote(localdir), 873 880 "") 874 881 fn = self._foo_node
Note: See TracChangeset
for help on using the changeset viewer.