Skip to content

Commit

Permalink
add error test
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelgrosso1 committed Sep 12, 2024
1 parent e806b7a commit 2eb18df
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ def test_inject_error(self):
context, rest_code=503, grpc_code=grpc.StatusCode.UNAVAILABLE
)
context.abort.assert_called_once_with(grpc.StatusCode.UNAVAILABLE, ANY)

def test_not_soft_deleted_error(self):
with self.assertRaises(error.RestException) as rest:
error.not_soft_deleted(None)
self.assertEqual(rest.exception.code, 412)

context = Mock()
error.not_soft_deleted(context)
context.abort.assert_called_once_with(grpc.StatusCode.FAILED_PRECONDITION, ANY)


if __name__ == "__main__":
Expand Down

0 comments on commit 2eb18df

Please sign in to comment.