def test_settings_merge_options1(self): options = CallOptions(timeout=46) settings = CallSettings(timeout=9, page_descriptor=None, retry=None) final = settings.merge(options) self.assertEqual(final.timeout, 46) self.assertIsNone(final.retry) self.assertIsNone(final.page_descriptor)
def test_settings_merge_options_page_streaming(self): retry = RetryOptions(None, None) options = CallOptions(timeout=46, is_page_streaming=False) settings = CallSettings(timeout=9, retry=retry) final = settings.merge(options) self.assertEqual(final.timeout, 46) self.assertIsNone(final.page_descriptor) self.assertEqual(final.retry, retry)
def test_settings_merge_options2(self): retry = RetryOptions(None, None) options = CallOptions(retry=retry) settings = CallSettings( timeout=9, page_descriptor=None, retry=RetryOptions(None, None)) final = settings.merge(options) self.assertEqual(final.timeout, 9) self.assertIsNone(final.page_descriptor) self.assertEqual(final.retry, retry)
def test_settings_merge_options2(self): retry = RetryOptions(None, None) options = CallOptions(retry=retry) settings = CallSettings(timeout=9, page_descriptor=None, retry=RetryOptions(None, None)) final = settings.merge(options) self.assertEqual(final.timeout, 9) self.assertIsNone(final.page_descriptor) self.assertEqual(final.retry, retry)
def test_settings_merge_none(self): settings = CallSettings( timeout=23, page_descriptor=object(), bundler=object(), retry=object()) final = settings.merge(None) self.assertEqual(final.timeout, settings.timeout) self.assertEqual(final.retry, settings.retry) self.assertEqual(final.page_descriptor, settings.page_descriptor) self.assertEqual(final.bundler, settings.bundler) self.assertEqual(final.bundle_descriptor, settings.bundle_descriptor)
def test_settings_merge_options_page_streaming(self): retry = RetryOptions(None, None) page_descriptor = object() options = CallOptions(timeout=46, page_token=INITIAL_PAGE) settings = CallSettings(timeout=9, retry=retry, page_descriptor=page_descriptor) final = settings.merge(options) self.assertEqual(final.timeout, 46) self.assertEqual(final.page_descriptor, page_descriptor) self.assertEqual(final.page_token, INITIAL_PAGE) self.assertFalse(final.flatten_pages) self.assertEqual(final.retry, retry)