def test_role_create(self): self.iam.role_delete() role = self.iam.role_create(policy_document) (Assert(role).field_is_equal('Arn', test_role_arn).field_is_equal( 'Path', '/').field_is_equal('RoleName', test_role).field_is_equal( 'AssumeRolePolicyDocument', policy_document)) assert self.iam.role_arn() == test_role_arn
def test_create_function(self): role_arn = IAM_Role(self.lambda_name + '__tmp_role').create_for__lambda().get('role_arn') tmp_folder = Temp_Folder_Code(self.lambda_name) ( self.aws_lambda.set_role (role_arn) .set_s3_bucket (self.s3_bucket ) .set_s3_key (self.s3_key ) .set_folder_code(tmp_folder.folder) ) assert self.aws_lambda.create_params() == (self.lambda_name, 'python3.7' , role_arn , self.lambda_name + '.run', 3008 , 60 , { 'Mode' : 'PassThrough' }, { 'S3Bucket': self.s3_bucket , 'S3Key' : self.s3_key }) # confirm values that will be passed to the boto3's create_function assert self.aws_lambda.upload() is True result = self.aws_lambda.create() data = result.get('data') name = result.get('name') status = result.get('status') assert status == 'ok' assert name == self.lambda_name expected_arn = 'arn:aws:lambda:{0}:{1}:function:{2}'.format(self.region,self.account_id,self.lambda_name) # expected arn value (Assert(data).field_is_equal('CodeSize' , 209 ) # confirm lambda creation details .field_is_equal('FunctionArn' , expected_arn ) .field_is_equal('FunctionName' , self.lambda_name ) .field_is_equal('Handler' , self.lambda_name + '.run') .field_is_equal('MemorySize' , 3008 ) .field_is_equal('Role' , role_arn ) .field_is_equal('Runtime' , 'python3.7' ) .field_is_equal('Timeout' , 60 ) .field_is_equal('TracingConfig', {'Mode': 'PassThrough'} ) .field_is_equal('Version' , '$LATEST' ) ) assert self.aws_lambda.delete() is True # confirm Lambda was deleted
def __init__(self,target): self._assert = Assert(target)
def test_setup(self): Assert(self.browser).is_class('API_Browser') Assert(self.vis_js.web_root).contains( 'serverless-render/osbot_browser/web_root') Assert(self.browser.sync__url()).is_equal('about:blank') Dev.print(self.browser.sync__url())
def test_user_info(self): user = self.iam.user_info() (Assert(user).field_is_equal('Arn', test_user_arn).field_is_equal( 'Path', '/').field_is_equal('UserName', test_user)) assert self.iam.set_user_name('AAAA').user_info() is None
def test_all_builds_ids(self): # LONG running test ids = list(self.code_build.all_builds_ids()) Assert(ids).size_is(100) ids = list(self.code_build.all_builds_ids(use_paginator=True)) Assert(ids).is_bigger_than(1000)
def test_projects(self): result = self.code_build.projects() Assert(result).is_bigger_than(2).is_smaller_than(100)
def test_project_info(self): project = self.code_build.project_info() (Assert(project).field_is_equal('arn', project_arn).field_is_equal( 'name', project_name).field_is_equal('serviceRole', service_role))