def test_revoke_product(self, mocked_revoke_journal_access): """ Test revoking a Journal product. """ JournalFulfillmentModule().revoke_line(self.lines[0]) mocked_revoke_journal_access.assert_called_once_with( site_configuration=self.lines[0].order.site.siteconfiguration, order_number=self.lines[0].order.number )
def test_fulfill_with_base_error(self): """ Test fulfilling a Journal product with raising the base exception """ __, completed_lines = JournalFulfillmentModule().fulfill_product(self.order, self.lines) self.assertEqual( completed_lines[0].status, LINE.FULFILLMENT_SERVER_ERROR )
def test_fulfill_product_without_attribute(self): """ Test fulfilling a Journal product with raising the AttributeError exception """ ProductAttribute.objects.get(product_class__name=JOURNAL_PRODUCT_CLASS_NAME, code='UUID').delete() __, completed_lines = JournalFulfillmentModule().fulfill_product(self.order, self.lines) self.assertEqual( completed_lines[0].status, LINE.FULFILLMENT_CONFIGURATION_ERROR )
def test_fulfill_product(self, mocked_post_journal_access): """ Test fulfilling a Journal product. """ __, completed_lines = JournalFulfillmentModule().fulfill_product( self.order, self.lines) mocked_post_journal_access.assert_called_once_with( site_configuration=self.order.site.siteconfiguration, order_number=self.order.number, username=self.order.user.username, journal_uuid=self.order.lines.first().product.attr.UUID) self.assertEqual(completed_lines[0].status, LINE.COMPLETE)
def test_revoke_line_invalid_order_number(self): self.assertFalse(JournalFulfillmentModule().revoke_line(self.lines[0]))
def test_revoke_line(self): self.assertTrue(JournalFulfillmentModule().revoke_line(self.lines[0]))
def test_get_supported_lines(self): """ Test that Journal lines where returned. """ supported_lines = JournalFulfillmentModule().get_supported_lines( self.lines) self.assertEqual(len(supported_lines), 1)
def test_supports_line(self): """ Test that a line containing Journal returns True. """ supports_line = JournalFulfillmentModule().supports_line(self.lines[0]) self.assertTrue(supports_line)