def test_setRenderedValue_product(self):
     # Passing a product branch target will set the widget's render state to
     # 'product'.
     self.widget.setUpSubWidgets()
     target = ProductBranchTarget(self.product)
     self.widget.setRenderedValue(target)
     self.assertEqual('product', self.widget.default_option)
     self.assertEqual(
         self.product, self.widget.product_widget._getCurrentValue())
Beispiel #2
0
def fake_product_to_branch_target(fake_product):
    """Adapt a `FakeProduct` to `IBranchTarget`."""
    return ProductBranchTarget(fake_product)
Beispiel #3
0
 def test_areBranchesMergeable_different_product(self):
     # Branches of a different product are not mergeable.
     other_target = ProductBranchTarget(self.factory.makeProduct())
     self.assertFalse(self.target.areBranchesMergeable(other_target))
Beispiel #4
0
 def test_areBranchesMergeable_same_product(self):
     # Branches of the same product are mergeable.
     same_target = ProductBranchTarget(self.original)
     self.assertTrue(self.target.areBranchesMergeable(same_target))
Beispiel #5
0
 def setUp(self):
     TestCaseWithFactory.setUp(self)
     self.original = self.factory.makeProduct()
     self.target = ProductBranchTarget(self.original)