Example #1
0
    def stage_base_configuration(self, stage, mocker):
        """
        This fixture configures the stage for testing.  This is automatically
        applied, so it will be called before your test runs, but it's not
        guaranteed to be called before any other fixtures run.  If you have
        a fixture that needs to rely on the stage being configured, then
        you have to add a manual dependency inside that fixture (like we do in
        next_stage_succeeds_all_ops below)
        """
        class NextStageForTest(pipeline_stages_base.PipelineStage):
            def _execute_op(self, op):
                pass

        next = NextStageForTest()
        root = (pipeline_stages_base.PipelineRootStage(
            config.BasePipelineConfig()).append_stage(stage).append_stage(next)
                )

        mocker.spy(stage, "_execute_op")
        mocker.spy(stage, "run_op")

        mocker.spy(next, "_execute_op")
        mocker.spy(next, "run_op")

        return root
 def test_receives_correct_config(self, stage, transport, mocker,
                                  op_set_connection_args):
     stage.pipeline_root = pipeline_stages_base.PipelineRootStage(
         config.BasePipelineConfig(websockets="__fake_boolean__"))
     stage.run_op(op_set_connection_args)
     assert transport.call_args == mocker.call(
         client_id=fake_client_id,
         hostname=fake_hostname,
         username=fake_username,
         ca_cert=fake_ca_cert,
         x509_cert=fake_certificate,
         websockets="__fake_boolean__",
     )