-
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.
fixes fccn/nau-technical#76
- Loading branch information
Showing
3 changed files
with
52 additions
and
4 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
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 |
---|---|---|
|
@@ -47,6 +47,7 @@ def json(self): | |
""" | ||
return self.json_data | ||
|
||
@property | ||
def content(self): | ||
""" | ||
The Json data | ||
|
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 |
---|---|---|
|
@@ -456,7 +456,7 @@ def test_send_to_financial_manager_without_basket_billing_information(self): | |
json_data="https://example.com/somereceipt.pdf", | ||
status_code=200, | ||
)) | ||
def test_get_receipt_link(self, mock_fm_receipt_link): | ||
def test_get_receipt_link_found(self, mock_fm_receipt_link): | ||
""" | ||
Test the `get_receipt_link` method. | ||
""" | ||
|
@@ -489,3 +489,48 @@ def test_get_receipt_link(self, mock_fm_receipt_link): | |
mock_fm_receipt_link.assert_called_once_with(f"https://finacial-manager.example.com/api/billing/receipt-link/{basket.order_number}/", headers={'Authorization': 'a-very-long-token'}, timeout=10) | ||
|
||
self.assertEqual(link, "https://example.com/somereceipt.pdf") | ||
|
||
@override_settings( | ||
NAU_FINANCIAL_MANAGER={ | ||
"edx": { | ||
"receipt-link-url": "https://finacial-manager.example.com/api/billing/receipt-link/", | ||
"token": "a-very-long-token", | ||
}, | ||
}, | ||
) | ||
@mock.patch.object(requests, "post", return_value=MockResponse( | ||
status_code=404, | ||
)) | ||
def test_get_receipt_link_not_found(self, mock_fm_receipt_link): | ||
""" | ||
Test the `get_receipt_link` method. | ||
""" | ||
partner = PartnerFactory(short_code="edX") | ||
|
||
site_configuration = SiteConfigurationFactory(partner=partner) | ||
site_configuration.site = SiteFactory(name="openedx") | ||
site = site_configuration.site | ||
|
||
course = CourseFactory( | ||
id="course-v1:edX+DemoX+Demo_Course", | ||
name="edX Demonstration Course", | ||
partner=partner, | ||
) | ||
honor_product = course.create_or_update_seat("honor", False, 0) | ||
verified_product = course.create_or_update_seat("verified", True, 10) | ||
|
||
owner = UserFactory(email="[email protected]") | ||
|
||
# create an empty basket so we know what it's inside | ||
basket = create_basket(owner=owner, empty=True, site=site) | ||
basket.add_product(verified_product) | ||
basket.add_product(honor_product) | ||
basket.save() | ||
|
||
# creating an order will mark the card submitted | ||
order = create_order(basket=basket) | ||
|
||
link = get_receipt_link(order) | ||
mock_fm_receipt_link.assert_called_once_with(f"https://finacial-manager.example.com/api/billing/receipt-link/{basket.order_number}/", headers={'Authorization': 'a-very-long-token'}, timeout=10) | ||
|
||
self.assertEqual(link, None) |