Esempio n. 1
0
 def test_feature_run_order_deactivate(self, mock_feature):
     """ A feature deactivate 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.new = False
             environment.deactivate()
             eq_(mock_call().method_calls, [call.should_run(),
                                            call.validate(),
                                            call.resolve(),
                                            call.prompt(),
                                            call.deactivate()])
Esempio n. 2
0
 def test_feature_run_order_deactivate(self):
     """ A feature deactivate 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.deactivate()
             eq_(formulabase().method_calls, [
                 call.should_run(),
                 call.validate(),
                 call.resolve(),
                 call.prompt(),
                 call.deactivate()
             ])
Esempio n. 3
0
 def test_feature_run_order_deactivate(self):
     """ A feature deactivate 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.deactivate.return_value = None
     environment.formula_dict['sprinter.formulabase'] = Mock(return_value=mock_formulabase)
     environment.deactivate()
     tools.eq_(mock_formulabase.method_calls, [call.should_run(),
                                               call.validate(),
                                               call.resolve(),
                                               call.prompt(),
                                               call.deactivate()])
Esempio n. 4
0
 def test_feature_run_order_deactivate(self):
     """ A feature deactivate 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.deactivate()
             eq_(
                 formulabase().method_calls,
                 [call.should_run(), call.validate(), call.resolve(), call.prompt(), call.deactivate()],
             )