1
# Copyright (C) 2005-2011, 2016 Canonical Ltd
1
# Copyright (C) 2005-2011, 2015, 2016 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
988
988
# perhaps all of this could be done in a subdirectory
990
990
t.put_bytes('a', 'a first file\n')
991
self.assertEquals([True, False], list(t.has_multi(['a', 'b'])))
991
self.assertEqual([True, False], list(t.has_multi(['a', 'b'])))
994
994
self.assertTrue(t.has('b'))
995
995
self.assertFalse(t.has('a'))
997
997
self.check_transport_contents('a first file\n', t, 'b')
998
self.assertEquals([False, True], list(t.has_multi(['a', 'b'])))
998
self.assertEqual([False, True], list(t.has_multi(['a', 'b'])))
1000
1000
# Overwrite a file
1001
1001
t.put_bytes('c', 'c this file\n')
1194
1194
raise TestSkipped("not a connected transport")
1196
1196
t2 = t1.clone('subdir')
1197
self.assertEquals(t1._parsed_url.scheme, t2._parsed_url.scheme)
1198
self.assertEquals(t1._parsed_url.user, t2._parsed_url.user)
1199
self.assertEquals(t1._parsed_url.password, t2._parsed_url.password)
1200
self.assertEquals(t1._parsed_url.host, t2._parsed_url.host)
1201
self.assertEquals(t1._parsed_url.port, t2._parsed_url.port)
1197
self.assertEqual(t1._parsed_url.scheme, t2._parsed_url.scheme)
1198
self.assertEqual(t1._parsed_url.user, t2._parsed_url.user)
1199
self.assertEqual(t1._parsed_url.password, t2._parsed_url.password)
1200
self.assertEqual(t1._parsed_url.host, t2._parsed_url.host)
1201
self.assertEqual(t1._parsed_url.port, t2._parsed_url.port)
1203
1203
def test__reuse_for(self):
1204
1204
t = self.get_transport()
1768
1768
"""Segment parameters should be stripped and stored in
1769
1769
transport.segment_parameters."""
1770
1770
transport = self.get_transport("foo")
1771
self.assertEquals({}, transport.get_segment_parameters())
1771
self.assertEqual({}, transport.get_segment_parameters())
1773
1773
def test_segment_parameters(self):
1774
1774
"""Segment parameters should be stripped and stored in
1777
1777
parameters = {"key1": "val1", "key2": "val2"}
1778
1778
url = urlutils.join_segment_parameters(base_url, parameters)
1779
1779
transport = _mod_transport.get_transport_from_url(url)
1780
self.assertEquals(parameters, transport.get_segment_parameters())
1780
self.assertEqual(parameters, transport.get_segment_parameters())
1782
1782
def test_set_segment_parameters(self):
1783
1783
"""Segment parameters can be set and show up in base."""
1784
1784
transport = self.get_transport("foo")
1785
1785
orig_base = transport.base
1786
1786
transport.set_segment_parameter("arm", "board")
1787
self.assertEquals("%s,arm=board" % orig_base, transport.base)
1788
self.assertEquals({"arm": "board"}, transport.get_segment_parameters())
1787
self.assertEqual("%s,arm=board" % orig_base, transport.base)
1788
self.assertEqual({"arm": "board"}, transport.get_segment_parameters())
1789
1789
transport.set_segment_parameter("arm", None)
1790
1790
transport.set_segment_parameter("nonexistant", None)
1791
self.assertEquals({}, transport.get_segment_parameters())
1792
self.assertEquals(orig_base, transport.base)
1791
self.assertEqual({}, transport.get_segment_parameters())
1792
self.assertEqual(orig_base, transport.base)
1794
1794
def test_stat_symlink(self):
1795
1795
# if a transport points directly to a symlink (and supports symlinks