From 811f7bfaf9a9aea404f0455153208d5d3513391f Mon Sep 17 00:00:00 2001 From: rrigato Date: Fri, 22 Dec 2023 07:12:09 -0800 Subject: [PATCH] remove dev test resources --- README.md | 4 - tests/requirements_homepage.txt | 4 - tests/test_dev_aws_resources.py | 148 -------------------------------- 3 files changed, 156 deletions(-) delete mode 100644 tests/requirements_homepage.txt delete mode 100644 tests/test_dev_aws_resources.py diff --git a/README.md b/README.md index ed98686..81dfb6b 100644 --- a/README.md +++ b/README.md @@ -55,10 +55,6 @@ only be deleted and recereated when in [ROLLBACK_COMPLETE state](https://stackov -#### tests - -- test_dev_aws_resources.py = tests dev website - #### web Static html/js/css hosted in the s3 bucket diff --git a/tests/requirements_homepage.txt b/tests/requirements_homepage.txt deleted file mode 100644 index 61b07ba..0000000 --- a/tests/requirements_homepage.txt +++ /dev/null @@ -1,4 +0,0 @@ -awscli>=1.18.66 -boto3>=1.13.16 -beautifulsoup4>=4.9.1 -requests>=2.23.0 diff --git a/tests/test_dev_aws_resources.py b/tests/test_dev_aws_resources.py deleted file mode 100644 index 4a18272..0000000 --- a/tests/test_dev_aws_resources.py +++ /dev/null @@ -1,148 +0,0 @@ -import boto3 -import logging -import os -import requests -import unittest - -ENVIRON_DEF = "dev" - -HOMEPAGE_URL = "http://dev-static-site-homepage.s3-website-us-east-1.amazonaws.com/" -WORKING_DIRECTORY = os.getcwd() - - -def get_logger(): - """Returns a boto cloudformation describe_stacks api call - Parameters - ---------- - stack_name: str - Name of the stack - - Returns - ------- - cf_response : dict - Dictionary output of the describe_stacks api call - - Raises - ------ - """ - """ - Adds the file name to the logs/ directory without - the extension - """ - logging.basicConfig( - filename=os.path.join( - WORKING_DIRECTORY, "logs/", os.path.basename(__file__).split(".")[0] - ), - format="%(asctime)s %(message)s", - datefmt="%m/%d/%Y %I:%M:%S %p", - level=logging.DEBUG, - ) - logging.info("\n") - - -def get_boto_clients(resource_name, region_name="us-east-1"): - """Returns the boto client for various cloudformation resources - Parameters - ---------- - resource_name : str - Name of the resource for the client - - region_name : str - aws region you are using, defaults to - us-east-1 - - Returns - ------- - - - Raises - ------ - """ - return boto3.client(resource_name, region_name) - - -class WebappLive(unittest.TestCase): - """Tests that the aws resources necessary for the webpage are running - - Note that if any of the below unit tests fail, - The python script will have a non-zero exit code - - This will cause any CodeBuild Builds to fail out - - Preventing the Code Pipeline from continuing to delivery - - Parameters - ---------- - - Returns - ------- - - Raises - ------ - """ - - @classmethod - def setUpClass(self): - """Unitest function that is run once for the class - Gets the arguements passed from the user - - Parameters - ---------- - - Returns - ------- - - Raises - ------ - """ - get_logger() - - def test_home_page(self): - """Tests that the aws resources necessary for the webpage are running - - Parameters - ---------- - request_url : str - Url string to send the request to - Returns - ------- - - Raises - ------ - """ - logging.info("Testing if the website is alive") - homepage_request = requests.get(HOMEPAGE_URL) - self.assertEqual(homepage_request.status_code, 200) - logging.info("The website is live") - - def test_homepage_image(self): - """Tests that the homepage image loaded - - Parameters - ---------- - - Returns - ------- - - Raises - ------ - """ - photo_request = requests.get(HOMEPAGE_URL + "images/myPhoto.jpg") - - self.assertEqual(photo_request.status_code, 200) - - logging.info("Photo is present on page") - - """ - Ensuring that the content-type of the response - is a jpg - """ - self.assertEqual( - "image/jpeg", photo_request.headers.get("Content-Type").split(";")[0] - ) - - logging.info("Image is a jpg mime type") - - -if __name__ == "__main__": - unittest.main()