def test_parse_info_response(self):
     content = read_file_content('./tests/responses/get_info.xml')
     result = Utils.parse_info_response(content, '/test_dir/test.txt',
                                        'localhost')
     self.assertEqual(result['created'], '2017-10-18T15:16:04Z')
     self.assertEqual(result['name'], 'test.txt')
     self.assertEqual(result['modified'], 'Wed, 18 Oct 2017 15:16:04 GMT')
     self.assertEqual(result['size'], '41')
Esempio n. 2
0
 def test_parse_info_response(self):
     content = '<?xml version="1.0" encoding="utf-8"?><d:multistatus xmlns:d="DAV:"><d:response>' \
               '<d:href>/test_dir/test.txt</d:href><d:propstat><d:status>HTTP/1.1 200 OK</d:status><d:prop>' \
               '<d:resourcetype/><d:getlastmodified>Wed, 18 Oct 2017 15:16:04 GMT</d:getlastmodified>' \
               '<d:getetag>ab0b4b7973803c03639b848682b5f38c</d:getetag><d:getcontenttype>text/plain' \
               '</d:getcontenttype><d:getcontentlength>41</d:getcontentlength><d:displayname>test.txt' \
               '</d:displayname><d:creationdate>2017-10-18T15:16:04Z</d:creationdate></d:prop></d:propstat>' \
               '</d:response></d:multistatus>'
     result = utils.parse_info_response(content.encode('utf-8'),
                                        '/test_dir/test.txt', 'localhost')
     self.assertEqual(result['created'], '2017-10-18T15:16:04Z')
     self.assertEqual(result['name'], 'test.txt')
     self.assertEqual(result['modified'], 'Wed, 18 Oct 2017 15:16:04 GMT')
     self.assertEqual(result['size'], '41')