refactors and more tests, all tests passing
changed miniuri.py changed test_miniuri.py
This commit is contained in:
parent
b2e669d4dc
commit
0843cc1f2b
2 changed files with 56 additions and 16 deletions
|
|
@ -47,8 +47,26 @@ class TestMiniUri(TestCase):
|
|||
def test_fragment(self):
|
||||
self.assertEqual(self.u.fragment, '5')
|
||||
|
||||
# test_change_
|
||||
# https://fox:pass@www.foxhop.net:81/path/filename.jpg?p=2#5
|
||||
# test edge case URIs
|
||||
|
||||
def test_uri_no_path(self):
|
||||
self.u = Uri('https://fox:pass@www.foxhop.net:81?p=2#5')
|
||||
self.assertEqual(self.u.path, '')
|
||||
self.assertEqual(self.u.uri, 'https://fox:pass@www.foxhop.net:81?p=2#5')
|
||||
|
||||
def test_uri_filename_only_path(self):
|
||||
self.u = Uri('https://fox:pass@www.foxhop.net:81/filename.jpg?p=2#5')
|
||||
self.assertEqual(self.u.path, '/filename.jpg')
|
||||
self.assertEqual(self.u.filename, 'filename.jpg')
|
||||
self.assertEqual(self.u.extension, 'jpg')
|
||||
self.assertEqual(self.u.uri, 'https://fox:pass@www.foxhop.net:81/filename.jpg?p=2#5')
|
||||
|
||||
def test_uri_trailing_slash_only_path(self):
|
||||
self.u = Uri('https://fox:pass@www.foxhop.net:81/?p=2#5')
|
||||
self.assertEqual(self.u.path, '/')
|
||||
self.assertEqual(self.u.uri, 'https://fox:pass@www.foxhop.net:81/?p=2#5')
|
||||
|
||||
# test_change_attributes:
|
||||
|
||||
def test_change_uri(self):
|
||||
self.u.uri = 'http://zell:sapp@wwws.foxhop.net:82/my/file.png?p=3#6'
|
||||
|
|
@ -93,23 +111,22 @@ class TestMiniUri(TestCase):
|
|||
self.assertEqual(self.u.uri, 'https://fox:pass@www.foxhop.net:82/path/filename.jpg?p=2#5')
|
||||
|
||||
def test_change_path(self):
|
||||
# TODO: filename and extension not updated
|
||||
self.u.path = '/my/file.png'
|
||||
self.assertEqual(self.u.path, '/my/file.png')
|
||||
self.assertEqual(self.u.filename, 'file.png')
|
||||
self.assertEqual(self.u.extension, 'png')
|
||||
self.assertEqual(self.u.uri, 'https://fox:pass@www.foxhop.net:82/my/file.png?p=2#5')
|
||||
self.assertEqual(self.u.uri, 'https://fox:pass@www.foxhop.net:81/my/file.png?p=2#5')
|
||||
|
||||
def test_change_filename(self):
|
||||
self.u.filename = 'file.png'
|
||||
self.assertEqual(self.u.filename, 'file.png')
|
||||
self.assertEqual(self.u.extension, 'png')
|
||||
self.assertEqual(self.u.uri, 'https://fox:pass@www.foxhop.net:81/path/file.png?p=2#5')
|
||||
|
||||
def test_change_extension(self):
|
||||
# TODO: attribute error
|
||||
self.u.extension = 'png'
|
||||
self.assertEqual(self.u.extension, 'png')
|
||||
self.assertEqual(self.u.filename, 'filename.png')
|
||||
self.assertEqual(self.u.extension, 'png')
|
||||
self.assertEqual(self.u.uri, 'https://fox:pass@www.foxhop.net:81/path/filename.png?p=2#5')
|
||||
|
||||
def test_change_query(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue