Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ramprasathmk committed Dec 9, 2024
0 parents commit 31084c2
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Ignore specific files
.env

# Ignore IDE files and folders
.idea
.vscode

# Ignore python dependencies and out dir's
__pycache__
__pycache__/*
.venv
.venv/*
.conda
.conda/*

# Ignore py out files
*.pyo
*.pyd
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# flask-github-actions-demo
21 changes: 21 additions & 0 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from flask import Flask
from dotenv import load_dotenv
import os

load_dotenv()

app = Flask(__name__)


@app.route('/<random_string>')
def return_backwards_string(random_string):
return "".join(reversed(random_string))


@app.route('/get-mode')
def get_mode():
return os.environ.get("MODE")


if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)
17 changes: 17 additions & 0 deletions app/main_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from main import return_backwards_string, get_mode
import unittest
import os


class TestMain(unittest.TestCase):
def test_return_backwards_string(self):
random_string = "This is my test string"
random_string_reversed = random_string[::-1]
self.assertEqual(random_string_reversed, return_backwards_string(random_string))

def test_get_env(self):
self.assertEqual(os.environ.get("MODE"), get_mode())


if __name__ == '__main__':
unittest.main()
9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
blinker==1.9.0
click==8.1.7
colorama==0.4.6
Flask==3.1.0
itsdangerous==2.2.0
Jinja2==3.1.4
MarkupSafe==3.0.2
python-dotenv==1.0.1
Werkzeug==3.1.3

0 comments on commit 31084c2

Please sign in to comment.