Skip to content

Test failures in test_getinfo() #16

@zopyx

Description

@zopyx

Fail against fs 2.0.27 due to improved checks.

============================================================================ FAILURES =============================================================================
____________________________________________________________________ TestBaseX86.test_getinfo _____________________________________________________________________

self = <webdavfs.tests.test_docker.TestBaseX86 testMethod=test_getinfo>

    def test_getinfo(self):
        # Test special case of root directory
        # Root directory has a name of ''
        root_info = self.fs.getinfo("/")
        self.assertEqual(root_info.name, "")
        self.assertTrue(root_info.is_dir)

        # Make a file of known size
        self.fs.setbytes("foo", b"bar")
        self.fs.makedir("dir")

        # Check basic namespace
        info = self.fs.getinfo("foo").raw
        self.assertIsInstance(info["basic"]["name"], text_type)
        self.assertEqual(info["basic"]["name"], "foo")
        self.assertFalse(info["basic"]["is_dir"])

        # Check basic namespace dir
        info = self.fs.getinfo("dir").raw
        self.assertEqual(info["basic"]["name"], "dir")
        self.assertTrue(info["basic"]["is_dir"])

        # Get the info
        info = self.fs.getinfo("foo", namespaces=["details"]).raw
        self.assertIsInstance(info, dict)
        self.assertEqual(info["details"]["size"], 3)
        self.assertEqual(info["details"]["type"], int(ResourceType.file))

        # Test getdetails
        self.assertEqual(info, self.fs.getdetails("foo").raw)

        # Raw info should be serializable
        try:
            json.dumps(info)
        except:
            assert False, "info should be JSON serializable"

        # Non existant namespace is not an error
        no_info = self.fs.getinfo("foo", "__nosuchnamespace__").raw
        self.assertIsInstance(no_info, dict)
        self.assertEqual(no_info["basic"], {"name": "foo", "is_dir": False})

        # Check a number of standard namespaces
        # FS objects may not support all these, but we can at least
        # invoke the code
        info = self.fs.getinfo("foo", namespaces=["access", "stat", "details"])

        # Check that if the details namespace is present, times are
        # of valid types.
        if 'details' in info.namespaces:
            details = info.raw['details']
            self.assertIsInstance(details.get('accessed'), (type(None), int, float))
            self.assertIsInstance(details.get('modified'), (type(None), int, float))
>           self.assertIsInstance(details.get('created'), (type(None), int, float))
E           AssertionError: '' is not an instance of (<class 'NoneType'>, <class 'int'>, <class 'float'>)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions