class test_Deploy(TestCase): def setUp(self): self.deploy = Deploy() self.deploy.oss_setup.setup_test_environment() self.result = None def tearDown(self): if self.result is not None: Dev.pprint(self.result) def test_deploy_lambda__oss_bot(self): self.deploy.deploy_lambda__oss_bot() def test_deploy_lambda__browser(self): self.result = self.deploy.deploy_lambda__browser() def test_deploy_lambda__slack_message(self): result = self.deploy.deploy_lambda__slack_message() Dev.pprint(result) def test_deploy_lambda_log_to_elk(self): lambda_package = self.deploy.deploy_lambda_log_to_elk() self.result = lambda_package._lambda.invoke() def test_lambda_browser(self): self.test_deploy_lambda__browser() from osbot_aws.apis.Lambda import Lambda self.result = Lambda('osbot_browser.lambdas.lambda_browser').invoke({})
def test__invoke__screenshot(self): deploy = Deploy() deploy.oss_setup.setup_test_environment() deploy.deploy_lambda__browser() payload = { "params": ["screenshot", "https://www.google.com/images", "1200"], 'data': { 'channel': 'DJ8UA0RFT' } } self.result = self.aws_lambda.invoke(payload)
def test_update_and_invoke(self): deploy = Deploy() deploy.oss_setup.setup_test_environment() deploy.deploy_lambda_png_to_slack() png_file = '/tmp/lambda_png_file.png' png_data = base64.b64encode(open(png_file, 'rb').read()).decode() Dev.pprint(len(png_data)) payload = { "png_data": png_data, 'aws_secrets_id':'slack-gs-bot', 'channel': 'DDKUZTK6X'} result = self.png_to_slack.invoke(payload) Dev.pprint(result)
def test_invoke(self): from oss_bot.Deploy import Deploy Deploy().deploy_lambda__slack_message() channel = 'DJ8UA0RFT' # oss_bot #API_OSS_Bot() payload = { 'text': 'this is a text', 'attachments': [{'text': 'an attach', 'color':'good'}], 'channel': channel } self.result = self.aws_lambda.invoke(payload)
def test_deploy_lambda__git_lambda(self): Deploy().setup().deploy_lambda__git_lambda()
def test_deploy_lambda__oss_bot(self): Deploy().setup().deploy_lambda__oss_bot()
def setUp(self): self.deploy = Deploy() self.deploy.oss_setup.setup_test_environment() self.result = None
def test_update_lambda(self): return Deploy().deploy_lambda__git_lambda()
def test_deploy_lambda__oss_bot(self): package = Deploy().setup().deploy_lambda__oss_bot() self.result = package._lambda.invoke()
def test_deploy_lambda__browser(self): package = Deploy().setup().deploy_lambda__browser() self.result = package._lambda.invoke()
def setUp(self): self.plant_to_png = Lambda('utils.puml_to_png') deploy = Deploy() deploy.oss_setup.setup_test_environment() deploy.deploy_lambda_puml_to_png()
def test__invoke__screenshot__no_channel(self): deploy = Deploy() deploy.oss_setup.setup_test_environment() deploy.deploy_lambda__browser() payload = {"params": ["screenshot", "https://www.google.com/images"]} self.result = self.aws_lambda.invoke(payload)