13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
"""Tests for Transport implementations.
155
155
self.assertEqual(True, t.has('a'))
156
156
self.assertEqual(False, t.has('c'))
157
157
self.assertEqual(True, t.has(urlutils.escape('%')))
158
self.assertEqual(list(t.has_multi(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'])),
159
[True, True, False, False, True, False, True, False])
158
self.assertEqual(list(t.has_multi(['a', 'b', 'c', 'd',
159
'e', 'f', 'g', 'h'])),
160
[True, True, False, False,
161
True, False, True, False])
160
162
self.assertEqual(True, t.has_any(['a', 'b', 'c']))
161
self.assertEqual(False, t.has_any(['c', 'd', 'f', urlutils.escape('%%')]))
162
self.assertEqual(list(t.has_multi(iter(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']))),
163
[True, True, False, False, True, False, True, False])
163
self.assertEqual(False, t.has_any(['c', 'd', 'f',
164
urlutils.escape('%%')]))
165
self.assertEqual(list(t.has_multi(iter(['a', 'b', 'c', 'd',
166
'e', 'f', 'g', 'h']))),
167
[True, True, False, False,
168
True, False, True, False])
164
169
self.assertEqual(False, t.has_any(['c', 'c', 'c']))
165
170
self.assertEqual(True, t.has_any(['b', 'b', 'b']))
670
675
self.assertTransportMode(temp_transport, f, mode)
677
def test_create_prefix(self):
678
t = self.get_transport()
679
sub = t.clone('foo').clone('bar')
682
except TransportNotPossible:
683
self.assertTrue(t.is_readonly())
685
self.assertTrue(t.has('foo/bar'))
672
687
def test_append_file(self):
673
688
t = self.get_transport()
1495
1510
transport.put_bytes('foo', 'bar')
1496
1511
transport3 = self.get_transport()
1497
1512
self.check_transport_contents('bar', transport3, 'foo')
1498
# its base should be usable. XXX: This is true only if we don't use
1499
# auhentication, otherwise 'base' doesn't mention the password and we
1500
# can't access it anymore since the password is lost (it *could* be
1501
# mentioned in the url given by the test server) --vila 090226
1502
transport4 = get_transport(transport.base)
1503
self.check_transport_contents('bar', transport4, 'foo')
1505
1514
# now opening at a relative url should give use a sane result:
1506
1515
transport.mkdir('newdir')
1507
transport5 = get_transport(transport.base + "newdir")
1516
transport5 = self.get_transport('newdir')
1508
1517
transport6 = transport5.clone('..')
1509
1518
self.check_transport_contents('bar', transport6, 'foo')