Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failures in test_getinfo() #16

Open
zopyx opened this issue Aug 6, 2018 · 0 comments
Open

Test failures in test_getinfo() #16

zopyx opened this issue Aug 6, 2018 · 0 comments
Assignees

Comments

@zopyx
Copy link
Contributor

zopyx commented Aug 6, 2018

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'>)
@zopyx zopyx self-assigned this Aug 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant