-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ahmedsadman/development
Structure change and basic CI/CD test
- Loading branch information
Showing
14 changed files
with
91 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
language: python | ||
python: | ||
- '3.7' | ||
install: | ||
- pip install -r requirements.txt | ||
script: | ||
- if [ "$TRAVIS_BRANCH" = "master" ]; then pytest tests/test_prod; fi | ||
- if [ "$TRAVIS_BRANCH" = "development" ]; then pytest tests/test_dev; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import os | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
|
||
class Config: | ||
"""holds all the configuration for the flask application""" | ||
|
||
# general config | ||
SECRET_KEY = os.environ.get("FLASK_SECRET_KEY") | ||
PROPAGATE_EXCEPTIONS = True | ||
|
||
# database for dev test | ||
SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL_DEV") | ||
SQLALCHEMY_TRACK_MODIFICATIONS = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from application import create_app | ||
from dotenv import load_dotenv | ||
from config_dev import Config | ||
|
||
load_dotenv() | ||
app = create_app() | ||
app = create_app(Config) | ||
|
||
if __name__ == "__main__": | ||
app.run(debug=True) |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import pytest | ||
from dotenv import load_dotenv | ||
from application import create_app | ||
from config_dev import Config | ||
|
||
# holds all the fixtures | ||
# fixtures are ran once during request, this client will be passed in | ||
# other test_*.py files | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def client(request): | ||
flask_app = create_app(Config) | ||
testing_client = flask_app.test_client() | ||
return testing_client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import pytest | ||
import json | ||
from application import create_app | ||
from dotenv import load_dotenv | ||
from config import Config | ||
|
||
|
||
def test_homepage(client): | ||
r = client.get("/") | ||
assert r.status_code == 200 | ||
|
||
|
||
def test_events(client): | ||
r = client.get("/events") | ||
# res = json.loads(r.data) | ||
assert r.status_code == 200 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import pytest | ||
from dotenv import load_dotenv | ||
from application import create_app | ||
from config import Config | ||
|
||
# holds all the fixtures | ||
# fixtures are ran once during request, this client will be passed in | ||
# other test_*.py files | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def client(request): | ||
flask_app = create_app(Config) | ||
testing_client = flask_app.test_client() | ||
return testing_client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from tests.test_dev.test_read import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from application import create_app | ||
from config import Config | ||
|
||
app = create_app() | ||
app = create_app(Config) |