Rev 58: Make the test suite pass, modulo relaxing constraints in bzr.dev (not yet in file:///net/bigmamac/Volumes/home/vila/.bazaar/plugins/local_test_server/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Feb 23 17:00:15 GMT 2009


At file:///net/bigmamac/Volumes/home/vila/.bazaar/plugins/local_test_server/

------------------------------------------------------------
revno: 58
revision-id: v.ladeuil+lp at free.fr-20090223170014-nbevq5i7iv58ywsn
parent: v.ladeuil+lp at free.fr-20090223131218-8nhpac12wk85xfw7
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: local_test_server
timestamp: Mon 2009-02-23 18:00:14 +0100
message:
  Make the test suite pass, modulo relaxing constraints in bzr.dev (not yet
  submitted to bzr core).
  
  * test_server.py:
  (LocalTestServer._build_symlink_under_data_dir): Pused up from
  LocalHTTPTestServer.
  (LocalTestServer.get_url, LocalHTTPTestServer.get_url): Moved from
  LocalTestServer, this had nothing to do there since it's using
  _symlink_name .
  (Muddleftpd): Now serve files throuhg a symlink under data dir as
  http servers.
  (Muddleftpd._build_base_url): Use anonymous as a user since we
  can.
  (Muddleftpd.get_url): Point to the symmlink.
  
  * configs/muddleftpd.conf: 
  Tweaks to allow anonymous login and grant him all rights.
-------------- next part --------------
=== modified file 'configs/muddleftpd.conf'
--- a/configs/muddleftpd.conf	2009-02-23 13:12:18 +0000
+++ b/configs/muddleftpd.conf	2009-02-23 17:00:14 +0000
@@ -43,22 +43,20 @@
 [section] anonymous
 
     # any host or username will match this group
-    ipacl A:*
+    ipacl A:127.0.0.1/255.255.255.255
     nameacl A:*
 
-    # tell the server to use chroot to the anonymous rootdir
-    chroot 1
-
-    # tell the server to use the ftp user as the anonymous rootdir
-    # and uid/gid
-    authparams ftp
+    # tell the server to NOT chroot to the anonymous rootdir
+    chroot 0
+    rootdir %(data_dir)s
+    homedir /
 
     # tell the server to use the anonymous authenticator, and
     # accept any password.
     authmethod anonymous
 
-    # disallow any changes to file permissions or upload umask
-    chmoding 0
+    # allow any changes to file permissions or upload umask
+    chmoding 1
 
     # print out this file when the user logs in. It is not relative
     # to anonymous's rootdir
@@ -73,11 +71,5 @@
     # set the umask files are uploaded with
     umask 077
 
-    # give anonymous user read/list access everywhere and add/list
-    # access to the incoming folder. The / on the end of the directive
-    # tells muddleftpd to apply ACL to a directory rather than a file.
-    # (chdir, list, read)
-    access /:CLR
-    # uncomment the following line to allow uploads to /incoming
-    # (chdir, list, read, add, mkdir)
-    # access /incoming/:CLRAM
+    # give anonymous user all accesses
+    access /:ALL

=== modified file 'test_server.py'
--- a/test_server.py	2009-02-23 13:12:18 +0000
+++ b/test_server.py	2009-02-23 17:00:14 +0000
@@ -160,15 +160,6 @@
         self._test_working_dir = os.getcwdu()
         self._base_url = self._build_base_url()
 
-    def get_url(self):
-        """See bzrlib.transport.Server.get_url."""
-        return self._base_url + self._symlink_name
-
-
-class LocalHTTPTestServer(LocalTestServer):
-
-    _url_protocol = 'http'
-
     def _build_symlink_under_data_dir(self):
         # Some servers (notably cherokee) don't check the file system when
         # serving files, relying on the assumption that nobody will change file
@@ -186,6 +177,11 @@
         os.symlink(self._test_working_dir,
                    osutils.pathjoin(data_dir, self._symlink_name))
 
+
+class LocalHTTPTestServer(LocalTestServer):
+
+    _url_protocol = 'http'
+
     def setUp(self, backing_transport_server=None):
         """Build a specific directory to be served."""
         # Hard to believe, but the directory to be served is the current one at
@@ -199,6 +195,10 @@
         data_dir = self._server.get_config_value('data_dir')
         osutils.delete_any(osutils.pathjoin(data_dir, self._symlink_name))
 
+    def get_url(self):
+        """See bzrlib.transport.Server.get_url."""
+        return self._base_url + self._symlink_name
+
 
 class LocalFTPTestServer(LocalTestServer):
 
@@ -338,14 +338,21 @@
 
     _server_name = 'muddleftpd'
 
+    def setUp(self, backing_transport_server=None):
+        """Build a specific directory to be served."""
+        # Hard to believe, but the directory to be served is the current one at
+        # setUp time...
+        super(Muddleftpd, self).setUp(backing_transport_server)
+        self._build_symlink_under_data_dir()
+
     def _build_base_url(self):
-        # We use anonymous to avoid having to store the password of the user
-        # running the tests
-        return '%s://anonymous@%s:%s' % (self._url_protocol,
-                                          self.host, self.port)
+        user = 'anonymous'
+        return '%s://%s@%s:%s/' % (self._url_protocol, user,
+                                   self.host, self.port)
+
     def get_url(self):
         """See bzrlib.transport.Server.get_url."""
-        return self._base_url + self._test_working_dir
+        return self._base_url + self._symlink_name
 
 
 # We have registered a transport for the purpose of adding new servers in the



More information about the bazaar-commits mailing list