示例#1
0
 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
     )
示例#2
0
 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
     )
示例#3
0
 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
     )
示例#4
0
 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)
示例#5
0
 def test_revoke_line_invalid_order_number(self):
     self.assertFalse(JournalFulfillmentModule().revoke_line(self.lines[0]))
示例#6
0
 def test_revoke_line(self):
     self.assertTrue(JournalFulfillmentModule().revoke_line(self.lines[0]))
示例#7
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)
示例#8
0
 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)