Skip to content

Commit

Permalink
refactor: split invalid path tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rafilong committed Jul 17, 2020
1 parent 84babed commit cd85e23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion tests/unit/v1/test_base_collection.py
Expand Up @@ -41,13 +41,19 @@ def test_constructor(self):
expected_path = (collection_id1, document_id, collection_id2)
self.assertEqual(collection._path, expected_path)

def test_constructor_invalid_path(self):
def test_constructor_invalid_path_empty(self):
with self.assertRaises(ValueError):
self._make_one()

def test_constructor_invalid_path_bad_collection_id(self):
with self.assertRaises(ValueError):
self._make_one(99, "doc", "bad-collection-id")

def test_constructor_invalid_path_bad_document_id(self):
with self.assertRaises(ValueError):
self._make_one("bad-document-ID", None, "sub-collection")

def test_constructor_invalid_path_bad_number_args(self):
with self.assertRaises(ValueError):
self._make_one("Just", "A-Document")

Expand Down
8 changes: 7 additions & 1 deletion tests/unit/v1/test_base_document.py
Expand Up @@ -47,13 +47,19 @@ def test_constructor(self):
)
self.assertEqual(document.path, expected_path)

def test_constructor_invalid_path(self):
def test_constructor_invalid_path_empty(self):
with self.assertRaises(ValueError):
self._make_one()

def test_constructor_invalid_path_bad_collection_id(self):
with self.assertRaises(ValueError):
self._make_one(None, "before", "bad-collection-id", "fifteen")

def test_constructor_invalid_path_bad_document_id(self):
with self.assertRaises(ValueError):
self._make_one("bad-document-ID", None)

def test_constructor_invalid_path_bad_number_args(self):
with self.assertRaises(ValueError):
self._make_one("Just", "A-Collection", "Sub")

Expand Down

0 comments on commit cd85e23

Please sign in to comment.