コード例 #1
0
    def test_library_endpoint(self):
        """Verify that Advantage collections and regular Overdrive
        collections start at different endpoints.
        """
        # Here's an Overdrive collection.
        main = self._collection(
            protocol=ExternalIntegration.OVERDRIVE,
            external_account_id="1",
        )
        main.external_integration.username = "******"
        main.external_integration.password = "******"
        main.external_integration.setting('website_id').value = '100'
        main.external_integration.setting('ils_name').value = 'default'

        # Here's an Overdrive API client for that collection.
        overdrive_main = MockOverdriveAPI(self._db, main)
        eq_("https://api.overdrive.com/v1/libraries/1",
            overdrive_main._library_endpoint)

        # Here's an Overdrive Advantage collection associated with the
        # main Overdrive collection.
        child = self._collection(
            protocol=ExternalIntegration.OVERDRIVE,
            external_account_id="2",
        )
        child.parent = main
        overdrive_child = MockOverdriveAPI(self._db, child)
        eq_('https://api.overdrive.com/v1/libraries/1/advantageAccounts/2',
            overdrive_child._library_endpoint)
コード例 #2
0
 def setup(self):
     super(OverdriveTestWithAPI, self).setup()
     self.api = MockOverdriveAPI(self._db, self.collection)
コード例 #3
0
 def setup(self):
     super(OverdriveTest, self).setup()
     self.collection = MockOverdriveAPI.mock_collection(self._db)
     base_path = os.path.split(__file__)[0]
     self.resource_path = os.path.join(base_path, "files", "overdrive")