def test_escaped_uppercase(self): """Uppercase letters are escaped for safety on Windows""" my_store = store.TransportStore(MemoryTransport(), prefixed=True, escaped=True) # a particularly perverse file-id! :-) self.assertEquals(my_store._relpath('C:<>'), 'be/%2543%253a%253c%253e')
def test__relpath_prefixed_suffixed(self): my_store = store.TransportStore(MockTransport(), True) my_store.register_suffix('bar') my_store.register_suffix('baz') self.assertEqual('45/foo.baz', my_store._relpath('foo', ['baz'])) self.assertEqual('45/foo.bar.baz', my_store._relpath('foo', ['bar', 'baz']))
def test_relpath_escaped(self): my_store = store.TransportStore(MemoryTransport()) self.assertEqual('%25', my_store._relpath('%'))
def test__relpath_prefixed(self): my_store = store.TransportStore(MockTransport(), True) self.assertEqual('45/foo', my_store._relpath('foo'))
def test__relpath_simple(self): my_store = store.TransportStore(MockTransport()) self.assertEqual("foo", my_store._relpath('foo'))
def test__relpath_unregister_suffixes(self): my_store = store.TransportStore(MockTransport()) self.assertRaises(ValueError, my_store._relpath, 'foo', ['gz']) self.assertRaises(ValueError, my_store._relpath, 'foo', ['dsc', 'gz'])
def test_register_invalid_suffixes(self): my_store = store.TransportStore(MockTransport()) self.assertRaises(ValueError, my_store.register_suffix, '/') self.assertRaises(ValueError, my_store.register_suffix, '.gz/bar')
def test__relpath_invalid(self): my_store = store.TransportStore(MockTransport()) self.assertRaises(ValueError, my_store._relpath, '/foo') self.assertRaises(ValueError, my_store._relpath, 'foo/')