This file contains hidden or 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
<!-- templates/dashboard.html --> | |
<!doctype html> | |
<html> | |
<head> | |
<title>Github OAuth</title> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <!-- load bulma css --> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- load fontawesome --> | |
<style> | |
body { padding-top:70px; } | |
</style> |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
"""This module has methods that are used in the other modules in this package.""" | |
import os | |
import requests | |
def set_flask_environment(app) -> str: | |
"""Set the flask development environment. |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
"""This module creates the routes for our API.""" | |
from flask import render_template, request | |
from API import app | |
from API.helpers import get_access_token, get_user_data | |
@app.route('/index', methods=['GET']) |
This file contains hidden or 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
<!-- templates/index.html --> | |
<!doctype html> | |
<html> | |
<head> | |
<title>Github OAuth</title> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <!-- load bulma css --> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- load fontawesome --> | |
<style> | |
body { padding-top:70px; } |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
"""This module contain the confuguration for the application.""" | |
import os | |
from dotenv import load_dotenv | |
load_dotenv() | |
class BaseConfig(): |
This file contains hidden or 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
@app.route('/home', methods=['GET']) | |
def home() -> str: | |
"""Provide the user with the option to register with GitHub.""" | |
return render_template('index.html', client_id=app.config['CLIENT_ID']), 200 |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
"""This module creates the routes for our API.""" | |
from API import app | |
@app.route('/index', methods=['GET']) | |
@app.route('/', methods=['GET']) | |
def index() -> dict: | |
"""Handle get requests to /index route. |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
"""This module contains initialization code for the API package.""" | |
from dotenv import load_dotenv | |
from flask import Flask | |
load_dotenv() | |
app = Flask(__name__) |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
"""This module sets up the fixtures that will be used in our testing.""" | |
import pytest | |
from API import app | |
@pytest.fixture | |
def client(): |
This file contains hidden or 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
[pytest] | |
minversion = 6.0 | |
addopts = -ra -q | |
testpaths = | |
tests/unit |