-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DE-870] Test customer exception deserialization, fix exceptions in t…
…ests
- Loading branch information
1 parent
44e988d
commit d87e1c6
Showing
3 changed files
with
29 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pytest | ||
|
||
from advancedbilling.exceptions.customer_error_response_exception import CustomerErrorResponseException | ||
from advancedbilling.controllers.customers_controller import CustomersController | ||
from advancedbilling.models.create_customer_request import CreateCustomerRequest | ||
from tests.data import InitCases | ||
|
||
|
||
class TestCustomers: | ||
def test_invalid_customer_creation_throws_422_error(self, customers_controller: CustomersController): | ||
customer_request = CreateCustomerRequest(InitCases.get_customer_request()) | ||
customers_controller.create_customer( | ||
customer_request | ||
) | ||
|
||
with pytest.raises(CustomerErrorResponseException) as e: | ||
customers_controller.create_customer( | ||
customer_request | ||
) | ||
|
||
assert e.value.response_code == 422 | ||
assert e.value.errors == ['Reference: must be unique - that value has been taken.'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters