Skip to content

Commit 44cec9f

Browse files
committed
updating tests
1 parent 4e9b0d0 commit 44cec9f

File tree

3 files changed

+47
-9
lines changed

3 files changed

+47
-9
lines changed

.travis.yml

-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ language: python
22
python:
33
- "2.7"
44

5-
#command to install dependencies
65
install:
76
- pip install -e . --process-dependency-links
8-
- pip install pyflakes
97

10-
#script: tests/run_test.sh
118
script:
129
- tests/run_test.sh

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
]
3030
},
3131
dependency_links = [
32-
'https://github.com/recast-hep/recast-database/tarball/master#egg=recast-database-0.0.2',
32+
'https://github.com/recast-hep/recast-database/tarball/master#egg=recast-database-0.0.1',
3333
]
3434
)

tests/test.py

+46-5
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,72 @@
11
import os
22

33
import unittest
4+
import recastfrontend.server
45
from recastfrontend.server import create_app
56
from recastfrontend.server import db
67
import recastdb.models
78
from flask import url_for
8-
9+
import json
910

1011
class FlaskClientTestCase(unittest.TestCase):
1112
def setUp(self):
1213
self.app = create_app()
14+
self.app.testing = True
1315
self.app_context = self.app.app_context()
1416
self.app_context.push()
15-
db.create_all()
16-
self.client = self.app.test_client(use_cookies=True)
17+
18+
with self.app.app_context():
19+
db.create_all()
20+
self.client = self.app.test_client()
1721

1822
def tearDown(self):
1923
db.session.remove()
2024
self.app_context.pop()
21-
2225

26+
def test_setup(self):
27+
self.assertTrue(self.app is not None)
28+
self.assertTrue(self.client is not None)
29+
2330
def test_home_page(self):
24-
#response = self.client.get(url_for('./'))
31+
response = self.client.get('/')
32+
self.assertTrue(response.status_code == 200)
33+
#json_response = json.loads(response.data.decode('utf-8'))
2534
#self.assetTrue('Stranger' in response.get_data(as_text=True))
2635
#print self.client.get(url_for('about'))
2736
pass
2837

38+
def test_about_page(self):
39+
response = self.client.get('/about')
40+
self.assertTrue(response.status_code == 200)
41+
42+
def test_analysis_page(self):
43+
response = self.client.get('/analyses')
44+
self.assertTrue(response.status_code == 200)
45+
46+
def test_show_last_analysis(self):
47+
query = recastdb.models.Analysis.query.all()
48+
self.assertTrue(len(query) > 0)
49+
response = self.client.get('/analysis/'+str(len(query)))
50+
self.assertTrue(response.status_code == 200)
51+
52+
def test_requests(self):
53+
response = self.client.get('/requests')
54+
self.assertTrue(response.status_code == 200)
55+
56+
def test_subscriptions(self):
57+
response = self.client.get('/subscriptions')
58+
self.assertTrue(response.status_code == 200)
59+
60+
def test_analysis_form(self):
61+
response = self.client.get('analysis_form')
62+
self.assertTrue(response.status_code == 200)
63+
64+
def test_show_last_request(self):
65+
query = recastdb.models.ScanRequest.query.all()
66+
self.assertTrue(len(query) > 0)
67+
response = self.client.get('request_form/'+str(len(query)))
68+
self.assertTrue(response.status_code == 200)
69+
2970
def test_db(self):
3071
user = recastdb.models.User(name="Test User", email="[email protected]")
3172
db.session.add(user)

0 commit comments

Comments
 (0)