Merge pull request #17 from dod-ccpo/add_tests_and_fix_workspaces
Add test that GETs all routes, and fix /workspaces route.
This commit is contained in:
commit
309f689ebd
5
Makefile
5
Makefile
@ -1,5 +0,0 @@
|
|||||||
test:
|
|
||||||
python -m pytest
|
|
||||||
|
|
||||||
clean:
|
|
||||||
find static/assets -type f |grep -v .gitignore | xargs rm
|
|
10
README.md
10
README.md
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
./script/setup
|
script/setup
|
||||||
|
|
||||||
The setup script will create a new Python virtual environment for the application to use. All of the scripts will activate this virutal envirnment automatically, but you can also manually activate it like this:
|
The setup script will create a new Python virtual environment for the application to use. All of the scripts will activate this virutal envirnment automatically, but you can also manually activate it like this:
|
||||||
|
|
||||||
@ -21,22 +21,18 @@ If you want to automatically load the virtual environment whenever you enter the
|
|||||||
|
|
||||||
To start the app and watch for changes:
|
To start the app and watch for changes:
|
||||||
|
|
||||||
DEBUG=1 ./script/server
|
DEBUG=1 script/server
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
To run unit tests:
|
To run unit tests:
|
||||||
|
|
||||||
./script/test
|
script/test
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
python -m pytest
|
python -m pytest
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
make test
|
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
tornado templates are like mustache templates -- add the
|
tornado templates are like mustache templates -- add the
|
||||||
|
@ -7,12 +7,12 @@ from tornado.web import url
|
|||||||
|
|
||||||
def make_app(**kwargs):
|
def make_app(**kwargs):
|
||||||
app = tornado.web.Application([
|
app = tornado.web.Application([
|
||||||
url( r"/", MainHandler, {'page': 'login'}, name='login' ),
|
url( r"/", MainHandler, {'page': 'login'}, name='login' ),
|
||||||
url( r"/home", MainHandler, {'page': 'home'}, name='home' ),
|
url( r"/home", MainHandler, {'page': 'home'}, name='home' ),
|
||||||
url( r"/workspaces", MainHandler, {'page': 'workspaces'}, name='workspaces' ),
|
url( r"/workspaces", MainHandler, {'page': 'workspaces'}, name='workspaces' ),
|
||||||
url( r"/requests", Request, {'page': 'requests'}, name='requests' ),
|
url( r"/requests", Request, {'page': 'requests'}, name='requests' ),
|
||||||
url( r"/requests/new", RequestNew, {'page': 'requests_new'}, name='request_new' ),
|
url( r"/requests/new", RequestNew, {'page': 'requests_new'}, name='request_new' ),
|
||||||
url( r"/requests/new/([0-9])", RequestNew, {'page': 'requests_new'}, name='request_form' ),
|
url( r"/requests/new/([0-9])", RequestNew, {'page': 'requests_new'}, name='request_form' ),
|
||||||
url( r"/users", MainHandler, {'page': 'users'}, name='users' ),
|
url( r"/users", MainHandler, {'page': 'users'}, name='users' ),
|
||||||
url( r"/reports", MainHandler, {'page': 'reports'}, name='reports' ),
|
url( r"/reports", MainHandler, {'page': 'reports'}, name='reports' ),
|
||||||
url( r"/calculator", MainHandler, {'page': 'calculator'}, name='calculator' ),
|
url( r"/calculator", MainHandler, {'page': 'calculator'}, name='calculator' ),
|
||||||
|
34
templates/workspaces.html.to
Normal file
34
templates/workspaces.html.to
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{% extends "base.html.to" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<main class="usa-section usa-content usa-width-one-whole" id="main-content">
|
||||||
|
|
||||||
|
<h1>Workspaces</h1>
|
||||||
|
|
||||||
|
<table class="usa-table-borderless" width="100%">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col" width="50%">Workplace Name</th>
|
||||||
|
<th scope="col" width="30%">Workplace Info</th>
|
||||||
|
<th scope="col" width="20%">Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<a href="">Unclassified IaaS and PaaS for Defense Digital Service (DDS)</a><br>
|
||||||
|
Task Order: #123456
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<span class="usa-label">23</span><br>Users
|
||||||
|
</td>
|
||||||
|
<td><button class="usa-button-secondary">Launch</button></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
{% end %}
|
||||||
|
|
23
tests/test_routes.py
Normal file
23
tests/test_routes.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import pytest
|
||||||
|
import tornado.web
|
||||||
|
from atst.app import make_app
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def app():
|
||||||
|
return make_app()
|
||||||
|
|
||||||
|
@pytest.mark.gen_test
|
||||||
|
def test_routes(http_client, base_url):
|
||||||
|
for path in (
|
||||||
|
'/',
|
||||||
|
'/home',
|
||||||
|
'/workspaces',
|
||||||
|
'/requests',
|
||||||
|
'/requests/new',
|
||||||
|
'/requests/new/1',
|
||||||
|
'/users',
|
||||||
|
'/reports',
|
||||||
|
'/calculator'
|
||||||
|
):
|
||||||
|
response = yield http_client.fetch(base_url + path)
|
||||||
|
assert response.code == 200
|
Loading…
x
Reference in New Issue
Block a user