How to use the placebo.utils.placebo_session function in placebo

To help you get started, we’ve selected a few placebo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xen0l / aws-gate / test / unit / test_list.py View on Github external
    @placebo_session
    def setUp(self, session):
        self.ec2 = session.resource('ec2', region_name='eu-west-1')
        self.ssm = session.client('ssm', region_name='eu-west-1')
github serverless / serverless-helpers-py / tests / test_cfn.py View on Github external
    @placebo_session
    def test_no_outputs(self, session):
        os.environ['SERVERLESS_STAGE'] = 'dev'
        os.environ['SERVERLESS_PROJECT_NAME'] = 'no_outputs'
        out = serverless_helpers.load_cfn_outputs(session)
        assert out == {}
github serverless / serverless-helpers-py / tests / test_cfn.py View on Github external
    @placebo_session
    def test_notfound(self, session):
        os.environ['SERVERLESS_STAGE'] = 'dev'
        os.environ['SERVERLESS_PROJECT_NAME'] = 'nonexistent'
        out = serverless_helpers.load_cfn_outputs(session)
        assert out == {}
github xen0l / aws-gate / test / unit / test_query.py View on Github external
    @placebo_session
    def setUp(self, session):
        self.ec2 = session.resource('ec2', region_name='eu-west-1')

        self.instance_id = 'i-0c32153096cd68a6d'
github serverless / serverless-helpers-py / tests / test_cfn.py View on Github external
    @placebo_session
    def test_normal_outputs(self, session):
        os.environ['SERVERLESS_STAGE'] = 'dev'
        os.environ['SERVERLESS_PROJECT_NAME'] = 'mws'
        out = serverless_helpers.load_cfn_outputs(session)
        assert len(out) == 2
        assert 'Description' in out['IamRoleArnLambda']
        assert 'Value' in out['IamRoleArnLambda']
        assert out['IamRoleArnLambda']['Value'].startswith('arn:aws:iam::123456789012')
        assert out['DynamoTable']['Description'] == 'Name of DDB table'

        assert os.getenv('SERVERLESS_CF_IamRoleArnLambda').startswith('arn:aws:iam::123456789012')
github garnaat / placebo / tests / unit / test_utils.py View on Github external
    @placebo_session
    def test_decorator(self, session):

        # Tear it up..
        PLACEBO_TEST_DIR = os.path.join(os.getcwd(), 'placebo_test_runs')
        prefix = 'TestUtils.test_decorator'
        record_dir = os.path.join(PLACEBO_TEST_DIR, prefix)
        self.assertTrue(os.path.exists(record_dir))

        # Tear it down..
        shutil.rmtree(PLACEBO_TEST_DIR)
github xen0l / aws-gate / test / unit / test_utils.py View on Github external
    @placebo_session
    def setUp(self, session):
        self.ec2 = session.resource('ec2', region_name='eu-west-1')

        self.instance_id = 'i-0c32153096cd68a6d'

        self.config_data = {
            'alias': 'test',
            'name': 'SSM-test',
            'profile': 'default',
            'region': 'eu-west-1'
        }

        self.config = MagicMock()
        self.config.configure_mock(**{
            'get_host.return_value': self.config_data
        })