Esempio n. 1
0
 def test_feature_run_order_install(self):
     """ A feature install 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.install()
             eq_(
                 formulabase().method_calls,
                 [call.should_run(), call.validate(), call.resolve(), call.prompt(), call.sync()],
             )
Esempio n. 2
0
 def test_feature_run_order_install(self, mock_feature):
     """ A feature install 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.install()
             eq_(mock_call().method_calls, [call.should_run(),
                                               call.validate(),
                                               call.resolve(),
                                               call.prompt(),
                                               call.sync()])
Esempio n. 3
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. 4
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. 5
0
 def test_feature_run_order_install(self):
     """ A feature install 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.install()
             eq_(formulabase().method_calls, [
                 call.should_run(),
                 call.validate(),
                 call.resolve(),
                 call.prompt(),
                 call.sync()
             ])
Esempio n. 6
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()
             ])
Esempio n. 7
0
 def test_feature_run_order_install(self):
     """ A feature install should have it's methods run in the proper order """
     environment = create_mock_environment(
         target_config=test_target
     )
     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.sync.return_value = None
     environment.formula_dict['sprinter.formulabase'] = Mock(return_value=mock_formulabase)
     environment.install()
     tools.eq_(mock_formulabase.method_calls, [call.should_run(),
                                               call.validate(),
                                               call.resolve(),
                                               call.prompt(),
                                               call.sync()])
Esempio n. 8
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()])