Skip to content

Commit

Permalink
Test retrieving doc from internet w/o local copy
Browse files Browse the repository at this point in the history
  • Loading branch information
parthea committed Dec 12, 2020
1 parent 7a8466c commit 8fc714f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/test_discovery.py
Expand Up @@ -1151,14 +1151,22 @@ def import_mock(name, *args, **kwargs):
class DiscoveryFromStaticDocument(unittest.TestCase):
def test_can_build_from_static_document_when_enabled(self):
http = HttpMockSequence([({"status": "400"}, "")])
drive = build("drive", "v3", http=http, cache_discovery=False, static_discovery=True)
drive = build("drive", "v3", http=http, cache_discovery=False,
static_discovery=True)
self.assertIsNotNone(drive)
self.assertTrue(hasattr(drive, "files"))

def test_disable_build_from_static_document(self):
http = HttpMockSequence([({"status": "400"}, "")])
with self.assertRaises(HttpError):
build("drive", "v3", http=http, cache_discovery=False, static_discovery=False)
build("drive", "v3", http=http, cache_discovery=False,
static_discovery=False)

def test_retrieve_from_internet_when_static_doc_does_not_exist(self):
http = HttpMockSequence([({"status": "400"}, "")])
with self.assertRaises(HttpError):
build("doesnotexist", "v3", http=http, cache_discovery=False,
static_discovery=True)


class DictCache(Cache):
Expand Down

0 comments on commit 8fc714f

Please sign in to comment.