示例#1
0
 def test_feature_run_order_activate(self, mock_feature):
     """ A feature should have it's methods run in the proper order """
     with patch('sprinter.core.featuredict.Feature', new=lambda *args: mock_feature) as mock_call:
         with MockEnvironment(test_source, test_target) as environment:
             environment.directory = Mock(spec=environment.directory)
             environment.directory.root_dir = "/tmp/"
             environment.directory.new = False
             environment.activate()
             eq_(mock_call().method_calls, [call.should_run(),
                                            call.validate(),
                                            call.resolve(),
                                            call.prompt(),
                                            call.activate()])
示例#2
0
 def test_feature_run_order_activate(self):
     """ A feature should have it's methods run in the proper order """
     with patch('sprinter.formula.base.FormulaBase',
                new=create_mock_formulabase()) as formulabase:
         with MockEnvironment(test_source,
                              test_target,
                              mock_formulabase=formulabase) as environment:
             environment.directory = Mock(spec=environment.directory)
             environment.directory.new = False
             environment.activate()
             eq_(formulabase().method_calls, [
                 call.should_run(),
                 call.validate(),
                 call.resolve(),
                 call.prompt(),
                 call.activate()
             ])
示例#3
0
 def test_feature_run_order_activate(self):
     """ A feature should have it's methods run in the proper order """
     environment = create_mock_environment(
         source_config=test_source,
         installed=True
     )
     mock_formulabase = Mock(spec=FormulaBase)
     mock_formulabase.resolve.return_value = None
     mock_formulabase.validate.return_value = None
     mock_formulabase.prompt.return_value = None
     mock_formulabase.activate.return_value = None
     environment.formula_dict['sprinter.formulabase'] = Mock(return_value=mock_formulabase)
     environment.activate()
     tools.eq_(mock_formulabase.method_calls, [call.should_run(),
                                               call.validate(),
                                               call.resolve(),
                                               call.prompt(),
                                               call.activate()])
示例#4
0
 def test_feature_run_order_activate(self):
     """ A feature should have it's methods run in the proper order """
     with patch("sprinter.formula.base.FormulaBase", new=create_mock_formulabase()) as formulabase:
         with MockEnvironment(test_source, test_target, mock_formulabase=formulabase) as environment:
             environment.directory = Mock(spec=environment.directory)
             environment.directory.root_dir = "/tmp/"
             environment.directory.new = False
             environment.activate()
             eq_(
                 formulabase().method_calls,
                 [call.should_run(), call.validate(), call.resolve(), call.prompt(), call.activate()],
             )