~veebers/autopilot/move-testing-process-run-fixture

« back to all changes in this revision

Viewing changes to autopilot/tests/unit/test_application_launcher.py

  • Committer: CI bot
  • Author(s): Ted Gould
  • Date: 2014-06-01 21:22:19 UTC
  • mfrom: (487.4.2 autopilot)
  • Revision ID: ps-jenkins@lists.canonical.com-20140601212219-0lhwu9eat3q4itt2
Name change for UAL 

Show diffs side-by-side

added added

removed removed

Lines of Context:
554
554
 
555
555
    def test_get_pid_calls_upstart_module(self):
556
556
        expected_return = self.getUniqueInteger()
557
 
        with patch.object(_l, 'UpstartAppLaunch') as mock_ual:
 
557
        with patch.object(_l, 'UbuntuAppLaunch') as mock_ual:
558
558
            mock_ual.get_primary_pid.return_value = expected_return
559
559
            observed = UpstartApplicationLauncher._get_pid_for_launched_app(
560
560
                'gedit'
564
564
            self.assertThat(expected_return, Equals(observed))
565
565
 
566
566
    def test_launch_app_calls_upstart_module(self):
567
 
        with patch.object(_l, 'UpstartAppLaunch') as mock_ual:
 
567
        with patch.object(_l, 'UbuntuAppLaunch') as mock_ual:
568
568
            UpstartApplicationLauncher._launch_app(
569
569
                'gedit',
570
570
                ['some', 'uris']
718
718
 
719
719
    def test_on_failed_sets_message_for_app_crash(self):
720
720
        self.assertFailedObserverSetsExtraMessage(
721
 
            _l.UpstartAppLaunch.AppFailed.CRASH,
 
721
            _l.UbuntuAppLaunch.AppFailed.CRASH,
722
722
            'Application crashed.'
723
723
        )
724
724
 
725
725
    def test_on_failed_sets_message_for_app_start_failure(self):
726
726
        self.assertFailedObserverSetsExtraMessage(
727
 
            _l.UpstartAppLaunch.AppFailed.START_FAILURE,
 
727
            _l.UbuntuAppLaunch.AppFailed.START_FAILURE,
728
728
            'Application failed to start.'
729
729
        )
730
730
 
772
772
        app_id = self.getUniqueString()
773
773
        case_addDetail = Mock()
774
774
        launcher = UpstartApplicationLauncher(case_addDetail)
775
 
        with patch.object(_l.UpstartAppLaunch, 'application_log_path') as p:
 
775
        with patch.object(_l.UbuntuAppLaunch, 'application_log_path') as p:
776
776
            p.return_value = None
777
777
            launcher._attach_application_log(app_id)
778
778
 
787
787
        with tempfile.NamedTemporaryFile(mode='w') as f:
788
788
            f.write(token)
789
789
            f.flush()
790
 
            with patch.object(_l.UpstartAppLaunch, 'application_log_path',
 
790
            with patch.object(_l.UbuntuAppLaunch, 'application_log_path',
791
791
                              return_value=f.name):
792
792
                launcher._attach_application_log(app_id)
793
793
 
808
808
            new=mock_glib_loop,
809
809
        )
810
810
        mock_UAL = Mock()
811
 
        patch_UAL = patch.object(_l, 'UpstartAppLaunch', new=mock_UAL)
 
811
        patch_UAL = patch.object(_l, 'UbuntuAppLaunch', new=mock_UAL)
812
812
        launcher = UpstartApplicationLauncher(mock_add_detail)
813
813
        app_id = self.getUniqueString()
814
814
        with ExitStack() as patches:
832
832
            new=mock_glib_loop,
833
833
        )
834
834
        mock_UAL = Mock()
835
 
        patch_UAL = patch.object(_l, 'UpstartAppLaunch', new=mock_UAL)
 
835
        patch_UAL = patch.object(_l, 'UbuntuAppLaunch', new=mock_UAL)
836
836
        launcher = UpstartApplicationLauncher(mock_add_detail)
837
837
        app_id = self.getUniqueString()
838
838
        with ExitStack() as patches:
858
858
        def fake_add_observer(fn, state):
859
859
            state['status'] = UpstartApplicationLauncher.Timeout
860
860
        mock_UAL.observer_add_app_stop = fake_add_observer
861
 
        patch_UAL = patch.object(_l, 'UpstartAppLaunch', new=mock_UAL)
 
861
        patch_UAL = patch.object(_l, 'UbuntuAppLaunch', new=mock_UAL)
862
862
        launcher = UpstartApplicationLauncher(mock_add_detail)
863
863
        app_id = self.getUniqueString()
864
864
        mock_logger = Mock()