def setUp(self): self.log = {} self.read_content = '' self.maxDiff = None class_dir = os.getcwd() file_source = os.path.join(class_dir, DEFAULT_SOURCE_ROOT, SETTINGS_FILE) self.settings_content = get_file_content(file_source) file_source = os.path.join(class_dir, DEFAULT_SOURCE_ROOT, POSTLIST_FILE) self.postlist_default = json.loads(get_file_content(file_source)) file_source = os.path.join(class_dir, DEFAULT_SOURCE_ROOT, ARCHIVE_FILE) self.archive_default = json.loads(get_file_content(file_source)) # create bucket and write json content to it self.s3resource = boto3.resource('s3', region_name=REGION) self.s3resource.create_bucket(Bucket=clp.sourcebucket) self.s3resource.create_bucket(Bucket=clp.listbucket) self.s3resource.create_bucket(Bucket=clp.targetbucket) self.s3client = boto3.client('s3', region_name=REGION) self.s3client.put_object(Bucket=clp.listbucket, Key=JSON_FILE, Body=JSON_TEXT) self.s3client.put_object(Bucket=clp.listbucket, Key=HTML_FILE, Body=HTML_TEXT) self.s3client.put_object(Bucket=clp.sourcebucket, Key=SETTINGS_FILE, Body=self.settings_content)
def setUp(self): self.log = {} self.read_content = '' self.maxDiff = None class_dir = os.getcwd() file_source = os.path.join(class_dir, DEFAULT_SOURCE_ROOT, SETTINGS_FILE) self.settings_content = get_file_content(file_source) file_source = os.path.join(class_dir, DEFAULT_SOURCE_ROOT, POSTLIST_FILE) self.postlist_default = json.loads(get_file_content(file_source)) file_source = os.path.join(class_dir, DEFAULT_SOURCE_ROOT, ARCHIVE_FILE) self.archive_default = json.loads(get_file_content(file_source)) file_source = os.path.join(class_dir, DEFAULT_SOURCE_ROOT, PAGINATION_FILE) self.pagination = json.loads(get_file_content(file_source)) file_source = os.path.join(class_dir, DEFAULT_SOURCE_ROOT, POSTLISTS_INFO_FILE) self.postlists_info = json.loads(get_file_content(file_source)) file_source = os.path.join(class_dir, DEFAULT_SOURCE_ROOT, CATEGORIES_FILE) categories = json.loads(get_file_content(file_source)) file_source = os.path.join(class_dir, DEFAULT_SOURCE_ROOT, AUTHORS_FILE) authors = json.loads(get_file_content(file_source)) self.list_meta = {'categories': categories, 'authors': authors} # create bucket and write json content to it self.s3resource = boto3.resource('s3', region_name=REGION) self.s3resource.create_bucket(Bucket=clp.sourcebucket) self.s3resource.create_bucket(Bucket=clp.listbucket) self.s3resource.create_bucket(Bucket=clp.targetbucket) self.s3client = boto3.client('s3', region_name=REGION) self.s3client.put_object(Bucket=clp.listbucket, Key=JSON_FILE, Body=JSON_TEXT) self.s3client.put_object(Bucket=clp.listbucket, Key=HTML_FILE, Body=HTML_TEXT) self.s3client.put_object(Bucket=clp.sourcebucket, Key=SETTINGS_FILE, Body=self.settings_content) # add templates file_source = os.path.join(class_dir, DEFAULT_SOURCE_ROOT, POSTS_TEMPLATE) self.posts_template_content = get_file_content(file_source) file_source = os.path.join(class_dir, DEFAULT_SOURCE_ROOT, CATEGORIES_TEMPLATE) self.categories_template_content = get_file_content(file_source) self.local_settings = libs.globals.DEFAULT_SETTINGS
def setUp(self): class_dir = os.getcwd() file_source = os.path.join(class_dir, FILE_SOURCE) self.source_content = get_file_content(file_source) self.log = {} self.read_content = '' # create bucket and write content to it self.s3resource = boto3.resource('s3', region_name=REGION) self.s3resource.create_bucket(Bucket=BUCKETNAME) self.s3client = boto3.client('s3', region_name=REGION) self.s3client.put_object(Bucket=BUCKETNAME, Key=FILENAME, Body=self.source_content)
def setUp(self): self.log = {} self.read_content = '' self.maxDiff = None self.search_result = '' class_dir = os.getcwd() file_source = os.path.join(class_dir,DEFAULT_SOURCE_ROOT,SETTINGS_FILE) self.settings_content = get_file_content(file_source) file_source = os.path.join(class_dir,DEFAULT_SOURCE_ROOT,POSTLIST_FILE) postlist = get_file_content(file_source) file_source = os.path.join(class_dir,DEFAULT_SOURCE_ROOT,CATEGORIES_FILE) categories = get_file_content(file_source) file_source = os.path.join(class_dir,DEFAULT_SOURCE_ROOT,AUTHORS_FILE) authors = get_file_content(file_source) file_source = os.path.join(class_dir,DEFAULT_SOURCE_ROOT,TEST1_POST_CONTENT) test1_post_content = get_file_content(file_source) file_source = os.path.join(class_dir,DEFAULT_SOURCE_ROOT,TEST2_POST_CONTENT) test2_post_content = get_file_content(file_source) file_source = os.path.join(class_dir,DEFAULT_SOURCE_ROOT,ABOUT_PAGE_CONTENT) about_page_content = get_file_content(file_source) # create bucket and write json content to it self.s3resource = boto3.resource('s3', region_name=REGION) self.s3resource.create_bucket(Bucket=sct.sourcebucket) self.s3resource.create_bucket(Bucket=sct.listbucket) self.s3resource.create_bucket(Bucket=sct.searchbucket) self.s3client = boto3.client('s3', region_name=REGION) self.s3client.put_object(Bucket=sct.sourcebucket, Key=SETTINGS_FILE, Body=self.settings_content) self.s3client.put_object(Bucket=sct.listbucket, Key=CATEGORIES_FILE, Body=categories) self.s3client.put_object(Bucket=sct.listbucket, Key=AUTHORS_FILE, Body=authors) self.s3client.put_object(Bucket=sct.listbucket, Key=POSTLIST_FILE, Body=postlist) self.s3client.put_object(Bucket=sct.searchbucket, Key=TEST1_POST_CONTENT, Body=test1_post_content) self.s3client.put_object(Bucket=sct.searchbucket, Key=TEST2_POST_CONTENT, Body=test2_post_content) self.s3client.put_object(Bucket=sct.searchbucket, Key=ABOUT_PAGE_CONTENT, Body=about_page_content)