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
from docxtpl import DocxTemplate, InlineImage | |
import sys | |
import os | |
word_doc_template = sys.argv[1] | |
word_doc_w_images_loaded = sys.argv[2] | |
image_dirname = sys.argv[3] | |
# Don't want to overwrite your template with the loaded images version. | |
assert word_doc_template != word_doc_w_images_loaded |
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
from .conftest import new_name, test_client, create_database | |
def test_new_name(new_name): | |
assert new_name.name == 'Mark' | |
def test_test_client(test_client): | |
assert test_client is not None |
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
<h1>Hello World!</h1> | |
<br> | |
<h3>Please enter a name:</h3> | |
<form method=post> | |
{{ form.csrf_token }} | |
{{ form.name.label }} | |
{{ form.name}} |
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
from flask import Flask, render_template, Blueprint | |
from .forms import NameForm | |
from .models import Name | |
from . import db | |
bp = Blueprint('app', __name__) | |
@bp.route('/', methods=['GET', 'POST']) | |
def home(): | |
form = NameForm() |
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
import pytest | |
from app.models import Name | |
from app import db | |
@pytest.yield_fixture(scope='module') | |
def create_database(): | |
db.create_all() | |
name = Name(name='Mark') | |
db.session.add(name) |
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
import pytest | |
from app.models import Name | |
from app import db | |
@pytest.yield_fixture(scope='module') | |
def create_database(): | |
db.create_all() | |
name = Name(name='Mark') | |
db.session.add(name) |
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
import pytest | |
from app import create_app | |
@pytest.yield_fixture(scope='module') | |
def test_client(): | |
app = create_app('testing') | |
testing_client = app.test_client() | |
ctx = app.app_context() | |
ctx.push() |
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
from .conftest import new_name | |
def test_new_name(new_name): | |
assert new_name.name == 'Mark' |
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
import pytest | |
from app.models import Name | |
@pytest.fixture(scope='module') | |
def new_name(): | |
name = Name(name='Mark') | |
return name |
NewerOlder