def setUp(self):
     """Common set-up code."""
     self.sa = SessionAssistant(self.APP_ID, self.APP_VERSION,
                                self.API_VERSION, self.API_FLAGS)
     # NOTE: setup a custom repository so that all tests are done in
     # isolation from the user account. While we're doing that, let's check
     # that this this function is allowed just after setting up the session.
     # We cannot really do that in tests later.
     self.repo_dir = tempfile.TemporaryDirectory()
     self.assertIn(self.sa.use_alternate_repository,
                   UsageExpectation.of(self.sa).allowed_calls)
     self.sa.use_alternate_repository(self.repo_dir.name)
     self.assertNotIn(self.sa.use_alternate_repository,
                      UsageExpectation.of(self.sa).allowed_calls)
     # Monitor the provider_selected signal since some tests check it
     self.watchSignal(self.sa.provider_selected)
     # Create a few mocked providers that tests can use.
     # The all-important plainbox provider
     self.p1 = mock.Mock(spec_set=Provider1, name='p1')
     self.p1.namespace = 'com.canonical.plainbox'
     self.p1.name = 'com.canonical.plainbox:special'
     # An example 3rd party provider
     self.p2 = mock.Mock(spec_set=Provider1, name='p2')
     self.p2.namespace = 'pl.zygoon'
     self.p2.name = 'pl.zygoon:example'
     # A Canonical certification provider
     self.p3 = mock.Mock(spec_set=Provider1, name='p3')
     self.p3.namespace = 'com.canonical.certification'
     self.p3.name = 'com.canonical.certification:stuff'
     # The stubbox provider, non-mocked, with lots of useful jobs
     self.stubbox = get_stubbox()
Ejemplo n.º 2
0
 def _make_representative_jobs(self):
     # Add all of the jobs from representative.pxu so that we don't have to
     # create verbose fakes. Each job gets a simple passing result.
     state = self.manager.default_device_context.state
     stubbox = get_stubbox(validate=False, check=True)
     for job in stubbox.job_list:
         if not job.partial_id.startswith('representative/plugin/'):
             continue
         state.add_unit(job)
         result = self._make_result_for(job)
         state.update_job_result(job, result)
         last_job = job
         last_result = result
     # Add a comment to one job (the last one)
     state.update_job_result(
         last_job,
         last_result.get_builder(comments='COMMENTS').get_result())
Ejemplo n.º 3
0
 def setUp(self):
     """Common set-up code."""
     self.sa = SessionAssistant(
         self.APP_ID, self.APP_VERSION, self.API_VERSION, self.API_FLAGS)
     # Monitor the provider_selected signal since some tests check it
     self.watchSignal(self.sa.provider_selected)
     # Create a few mocked providers that tests can use.
     # The all-important plainbox provider
     self.p1 = mock.Mock(spec_set=Provider1, name='p1')
     self.p1.namespace = 'com.canonical.plainbox'
     self.p1.name = 'com.canonical.plainbox:special'
     # An example 3rd party provider
     self.p2 = mock.Mock(spec_set=Provider1, name='p2')
     self.p2.namespace = 'pl.zygoon'
     self.p2.name = 'pl.zygoon:example'
     # A Canonical certification provider
     self.p3 = mock.Mock(spec_set=Provider1, name='p3')
     self.p3.namespace = 'com.canonical.certification'
     self.p3.name = 'com.canonical.certification:stuff'
     # The stubbox provider, non-mocked, with lots of useful jobs
     self.stubbox = get_stubbox()
Ejemplo n.º 4
0
 def _load_providers(self):
     logger.info("Loading stubbox provider...")
     from plainbox.impl.providers.special import get_stubbox
     from plainbox.impl.providers.special import get_exporters
     return [get_stubbox(), get_exporters()]