Пример #1
0
def test_match_content():
    def read(file_name):
        return open(file_name, "r").read()
    app = BootFlask("my_blog")
    app.start(False)
    assert read("my_blog/templates/index.html") == "<h1>Hello World</h1>"
    app.project.destroy()
Пример #2
0
def test_create_project():
    hello = BootFlask("helloworld")
    hello.start(False)
    assert os.path.isdir("helloworld")
    assert os.path.isfile('helloworld/Procfile')
    assert os.path.isfile('helloworld/app.py')
    assert os.path.isfile('helloworld/main.py')
    assert os.path.isfile('helloworld/settings.py')
    assert os.path.isfile('helloworld/templates/index.html')
    assert os.path.isfile('helloworld/.env')
    hello.project.destroy()
Пример #3
0
def test_create_project():
    backend = BootFlask("backend", type="api")
    backend.start(False)
    assert os.path.isdir("backend")
    assert os.path.isfile('backend/app/__init__.py')
    assert os.path.isfile('backend/app/api.py')
    assert os.path.isfile('backend/app/db.py')
    assert os.path.isfile('backend/app/models.py')
    assert os.path.isfile('backend/app/resources.py')
    assert os.path.isfile('backend/app/schemas.py')
    assert os.path.isfile('backend/.env')
    assert os.path.isfile('backend/Procfile')
    backend.project.destroy()
Пример #4
0
def test_create_project():
    backend = BootFlask("backend", type="api")
    backend.start(False)
    assert os.path.isdir("backend")
    assert os.path.isfile('backend/app/__init__.py')
    assert os.path.isfile('backend/app/api.py')
    assert os.path.isfile('backend/app/db.py')
    assert os.path.isfile('backend/app/models.py')
    assert os.path.isfile('backend/app/resources.py')
    assert os.path.isfile('backend/app/schemas.py')
    assert os.path.isfile('backend/.env')
    assert os.path.isfile('backend/Procfile')
    assert os.path.isfile('backend/Dockerfile')
    assert os.path.isfile('backend/docker-compose.yml')
    backend.project.destroy()
Пример #5
0
def _test_exist_project():
    principal = BootFlask("backend")
    principal.start(False)
    with pytest.raises(BootFlaskException) as e:
        hello = BootFlask("backend")
        hello.start(False)
    assert str(e.value) == "Exist one folder with name 'backend'."
    principal.project.destroy()
Пример #6
0
def _test_exist_project():
    principal = BootFlask("backend")
    principal.start(False)
    with pytest.raises(BootFlaskException) as e:
        hello = BootFlask("backend")
        hello.start(False)
    assert str(e.value) == "Exist one folder with name 'backend'."
    principal.project.destroy()
Пример #7
0
def test_container_name():
    backend = BootFlask("backend", type="api")
    backend.start(False)

    assert 'backend' in open('backend/docker-compose.yml').read()
    backend.project.destroy()
Пример #8
0
def test_assertion_error():
    with pytest.raises(AssertionError) as e:
        BootFlask()
    assert str(e.value) == "The name project it's necessary to create app."