How to use the onedrivesdk.model.item.Item function in onedrivesdk

To help you get started, we’ve selected a few onedrivesdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xybu / onedrived-dev / tests / test_hashutils.py View on Github external
def _mock_item(self, sha1_hash=None):
        prop_dict = dict()
        if sha1_hash:
            prop_dict['sha1Hash'] = sha1_hash
        item = Item(prop_dict={'file': {'hashes': prop_dict}})
        self.assertEqual(sha1_hash, item.file.hashes.sha1_hash)
        return item
github OneDrive / onedrive-sdk-python / testonedrivesdk / test_models.py View on Github external
def test_serialization(self):
        """
        Test the serialization of the dict-backed models, seeing that
        the correct objects are returned when called
        """
        ref = ItemReference();
        ref._prop_dict = {"id": self.id}

        response = {"name":self.name, "folder":{}, "parentReference":ref._prop_dict, "lastModifiedDateTime": "2015-07-09T22:22:53.993000Z"}

        item = Item();
        item._prop_dict = response

        assert isinstance(item.folder, Folder)
        assert item.name == self.name
        assert isinstance(item.parent_reference, ItemReference)
        assert item.parent_reference.id == self.id
        assert isinstance(item.last_modified_date_time, datetime)
        assert item.last_modified_date_time.isoformat()+"Z" == response["lastModifiedDateTime"]
github OneDrive / onedrive-sdk-python / testonedrivesdk / test_models.py View on Github external
def test_serialization_different_datetime(self):
        """
        Test the serialization of the dict-backed models, seeing that
        the correct objects are returned when called. Specifically,
        ensure that the datetime can be parsed correctly when the format
        does not fit exactly what we always return
        """
        ref = ItemReference();
        ref._prop_dict = {"id": self.id}

        response = {"name":self.name, "folder":{}, "parentReference":ref._prop_dict, "lastModifiedDateTime": "2015-07-09T22:22:53.99Z"}

        item = Item();
        item._prop_dict = response

        assert isinstance(item.folder, Folder)
        assert item.name == self.name
        assert isinstance(item.parent_reference, ItemReference)
        assert item.parent_reference.id == self.id
        assert isinstance(item.last_modified_date_time, datetime)
        assert item.last_modified_date_time.isoformat()+"Z" == "2015-07-09T22:22:53.990000Z"

        response = {"name":self.name, "folder":{}, "parentReference":ref._prop_dict, "lastModifiedDateTime": "2015-07-09T22:22:53Z"}
        item._prop_dict = response

        assert isinstance(item.folder, Folder)
        assert item.name == self.name
        assert isinstance(item.parent_reference, ItemReference)
        assert item.parent_reference.id == self.id