# Path: onedrived/od_api_helper.py
# THROTTLE_PAUSE_SEC = 60
# def get_drive_request_builder(repo):
# def create_subscription(folder_item_request, repo, webhook_url, expiration_time):
# def update_subscription(self, subscription):
# def get_item_modified_datetime(item):
# def get_item_created_datetime(item):
# def item_request_call(repo, request_func, *args, **kwargs):


import unittest
    import mock
import arrow
import requests
    from unittest import mock
from onedrivesdk import Item, FileSystemInfo, error
from onedrived import od_api_helper
            self.count = 1
            raise excep
        elif self.count > 1:
            raise ValueError('Dummy counter exceeds expected value 1.')

    def setUp(self):
        self.count = 0
        self.item = Item()

    def test_get_item_modified_datetime_modifiable(self):
        fs = FileSystemInfo()
        fs.last_modified_date_time = self.SAMPLE_ARROW_OBJ.datetime
        self.item.file_system_info = fs
        t, w = od_api_helper.get_item_modified_datetime(self.item)
        self.assertTrue(w, 'fileSystemInfo.lastModifiedDateTime should be modifiable.')
        self.assertEqual(self.SAMPLE_ARROW_OBJ, t)

    def test_get_item_modified_datetime_unmodifiable(self):
        self.item.last_modified_date_time = self.SAMPLE_ARROW_OBJ.datetime
        t, w = od_api_helper.get_item_modified_datetime(self.item)
        self.assertFalse(w, 'lastModifiedDateTime should be immutable.')
        self.assertEqual(self.SAMPLE_ARROW_OBJ, t)

    def test_get_item_created_datetime(self):
        self.item.created_date_time = self.SAMPLE_ARROW_OBJ.datetime
        self.assertEqual(self.SAMPLE_ARROW_OBJ, od_api_helper.get_item_created_datetime(self.item))

    @mock.patch('time.sleep')
    def test_item_request_call_on_connection_error(self, mock_sleep):
        od_api_helper.item_request_call(None, self.dummy_api_call, requests.ConnectionError())

# Path: onedrived/od_api_helper.py
# THROTTLE_PAUSE_SEC = 60
# def get_drive_request_builder(repo):
# def create_subscription(folder_item_request, repo, webhook_url, expiration_time):
# def update_subscription(self, subscription):
# def get_item_modified_datetime(item):
# def get_item_created_datetime(item):
# def item_request_call(repo, request_func, *args, **kwargs):


# Path: tests/test_api_helper.py
import unittest
    import mock
import arrow
import requests
    from unittest import mock
from onedrivesdk import Item, FileSystemInfo, error
from onedrived import od_api_helper

            self.count = 1
            raise excep
        elif self.count > 1:
            raise ValueError('Dummy counter exceeds expected value 1.')

    def setUp(self):
        self.count = 0
        self.item = Item()

    def test_get_item_modified_datetime_modifiable(self):
        fs = FileSystemInfo()
        fs.last_modified_date_time = self.SAMPLE_ARROW_OBJ.datetime
        self.item.file_system_info = fs
        t, w = od_api_helper.get_item_modified_datetime(self.item)
        self.assertTrue(w, 'fileSystemInfo.lastModifiedDateTime should be modifiable.')
        self.assertEqual(self.SAMPLE_ARROW_OBJ, t)

    def test_get_item_modified_datetime_unmodifiable(self):
        self.item.last_modified_date_time = self.SAMPLE_ARROW_OBJ.datetime
        t, w = od_api_helper.get_item_modified_datetime(self.item)
        self.assertFalse(w, 'lastModifiedDateTime should be immutable.')
        self.assertEqual(self.SAMPLE_ARROW_OBJ, t)

    def test_get_item_created_datetime(self):
        self.item.created_date_time = self.SAMPLE_ARROW_OBJ.datetime
        self.assertEqual(self.SAMPLE_ARROW_OBJ, od_api_helper.get_item_created_datetime(self.item))

    @mock.patch('time.sleep')
    def test_item_request_call_on_connection_error(self, mock_sleep):
        od_api_helper.item_request_call(None, self.dummy_api_call, requests.ConnectionError())

        mock_sleep.assert_called_once_with(od_api_helper.THROTTLE_PAUSE_SEC)