Skip to content

Commit

Permalink
Merge pull request #38 from SammyTbeile/master
Browse files Browse the repository at this point in the history
Tagged Tests
  • Loading branch information
SammyTbeile authored Dec 20, 2016
2 parents e9e4770 + a8e6ab5 commit 5044c99
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 5 deletions.
4 changes: 2 additions & 2 deletions coverage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ss-ase/app/login/controllers.py 37 1 97%
ss-ase/app/login/forms.py 14 0 100%
ss-ase/app/login/models.py 23 1 96%
ss-ase/config.py 6 0 100%
ss-ase/test_listing.py 77 0 100%
ss-ase/test_listing.py 76 0 100%
ss-ase/test_login.py 58 0 100%
--------------------------------------------------------------
TOTAL 316 43 86%
TOTAL 315 43 86%
2 changes: 1 addition & 1 deletion fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def test():
local("coverage run --rcfile=.coveragerc ./ss-ase/test_login.py")
local("coverage run --rcfile=.coveragerc -a ./ss-ase/test_listing.py")
local("coverage report > coverage.txt")
local("coverage report -m")
local("coverage report")
8 changes: 7 additions & 1 deletion ss-ase/test_listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def add_listing_invalid(self, title, size, price, info):
def get_feed(self):
return self.app.get('/feed', follow_redirects=True)

# Iteration 1
def test_add_listing_invalid(self):
print("Testing adding a listing with invalid attributes")
rv = self.add_listing_invalid(
Expand All @@ -76,9 +77,9 @@ def test_add_listing_invalid(self):
price='10',
info='wash'
)
print(str(rv.data))
assert '400' in str(rv.status)

# Iteration 1
def test_add_listing_valid(self):
print("Testing adding a listing with valid attributes")
self.login('tester', 'a')
Expand All @@ -99,28 +100,33 @@ def test_add_listing_valid(self):
)
assert '400' in str(rv.status)

# Iteration 1
def test_feed_unauthenticated(self):
print("testing getting the feed while unauthorized")
self.app.get("/login/logout", follow_redirects=True)
rv = self.get_feed()
assert '401' in str(rv.status)

# Iteration 1
def test_feed_authenticated(self):
print("testing getting the feed while authenticated")
self.login("z", "a")
rv = self.get_feed()
assert '200' in str(rv.status)

# Post iteration 1
def test_get_list(self):
print("tetsting getting the listing")
rv = self.app.get("/list", follow_redirects=True)
assert 'Create a Listing' in str(rv.data)

# Post iteration 1
def test_index(self):
print("testing getting the index")
rv = self.app.get("/", follow_redirects=True);
assert 'Rags2Riches' in str(rv.data)

# Post iteration 1
def test_get_item(self):
print("testing getting an item")
rv = self.app.get("/listing/cufflinks")
Expand Down
10 changes: 9 additions & 1 deletion ss-ase/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ def register(self, username, name, email, phone, dorm_building,
confirm=confirm
), follow_redirects=True)

# Iteration 1
def test_login_failure(self):
print("testing that failed login returns the login page")
rv = self.login('wrong', 'test')
assert 'Login' in str(rv.data)

# Iteration 1
def test_register(self):
print("testing registration")
rv = self.register(
Expand All @@ -55,6 +57,7 @@ def test_register(self):
'a')
assert 'Login' in str(rv.data)

# Post iteration 1
def test_double_register(self):
print("testing double registration")
self.register(
Expand All @@ -75,6 +78,7 @@ def test_double_register(self):
'a')
assert 'Username is not unique' in str(rv.data)

# Iteration 1
def test_invalid_registration(self):
print("testing invalid registration")
rv = self.register(
Expand All @@ -87,7 +91,7 @@ def test_invalid_registration(self):
'b')
assert 'Invalid registration' in str(rv.data)


# Iteration 1
def test_login(self):
print("testing login")
User(username='tester', password='a', email='[email protected]',
Expand All @@ -96,11 +100,13 @@ def test_login(self):
rv = self.login('tester', 'a')
assert 'Feed' in str(rv.data)

# Iteration 1
def test_logout(self):
print("test logout")
rv = self.logout()
assert 'Login' in str(rv.data)

# Post iteration 1
def test_is_authenticated(self):
print("test is_authenticated")
user = User(username='tester', password='a', email='[email protected]',
Expand All @@ -109,13 +115,15 @@ def test_is_authenticated(self):
result = user.is_authenticated()
assert (result == True)

# Post iteration 1
def test_is_active(self):
print("test is_active")
user = User(username='tester', password='a', email='[email protected]',
phone='1234567890', name='a', dorm_building='a',
confirm='a').save()
assert (user.is_active() == True)

# Post iteration 1
def test_is_anonymous(self):
print("test is_anonymous")
user = User(username='tester', password='a', email='[email protected]',
Expand Down
113 changes: 113 additions & 0 deletions test_run.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.mongoengine is deprecated, use flask_mongoengine instead.
.format(x=modname), ExtDeprecationWarning
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.mongoengine.wtf is deprecated, use flask_mongoengine.wtf instead.
.format(x=modname), ExtDeprecationWarning
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.mongoengine.wtf.orm is deprecated, use flask_mongoengine.wtf.orm instead.
.format(x=modname), ExtDeprecationWarning
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.mongoengine.wtf.fields is deprecated, use flask_mongoengine.wtf.fields instead.
.format(x=modname), ExtDeprecationWarning
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.mongoengine.wtf.models is deprecated, use flask_mongoengine.wtf.models instead.
.format(x=modname), ExtDeprecationWarning
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.wtf is deprecated, use flask_wtf instead.
.format(x=modname), ExtDeprecationWarning
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.mongoengine.wtf.base is deprecated, use flask_mongoengine.wtf.base instead.
.format(x=modname), ExtDeprecationWarning
/mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:34: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = RegistrationForm(request.form)
/mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
/mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:34: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = RegistrationForm(request.form)
./mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:34: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = RegistrationForm(request.form)
..../mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
./mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
./mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
./mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:34: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = RegistrationForm(request.form)
/mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
.
----------------------------------------------------------------------
Ran 9 tests in 2.072s

OK
testing double registration
testing invalid registration
test is_active
test is_anonymous
test is_authenticated
testing login
testing that failed login returns the login page
test logout
testing registration
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.mongoengine is deprecated, use flask_mongoengine instead.
.format(x=modname), ExtDeprecationWarning
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.mongoengine.wtf is deprecated, use flask_mongoengine.wtf instead.
.format(x=modname), ExtDeprecationWarning
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.mongoengine.wtf.orm is deprecated, use flask_mongoengine.wtf.orm instead.
.format(x=modname), ExtDeprecationWarning
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.mongoengine.wtf.fields is deprecated, use flask_mongoengine.wtf.fields instead.
.format(x=modname), ExtDeprecationWarning
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.mongoengine.wtf.models is deprecated, use flask_mongoengine.wtf.models instead.
.format(x=modname), ExtDeprecationWarning
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.wtf is deprecated, use flask_wtf instead.
.format(x=modname), ExtDeprecationWarning
/usr/local/lib/python2.7/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.mongoengine.wtf.base is deprecated, use flask_mongoengine.wtf.base instead.
.format(x=modname), ExtDeprecationWarning
/mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
./mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
/mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
./mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
/mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
./mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
/mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
./mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
./mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
./mnt/c/Users/Sammy/Documents/MEGAsync/Documents/Columbia Junior Year/Advanced Software Engineering/ss-ase/ss-ase/app/login/controllers.py:13: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm(request.form)
.
----------------------------------------------------------------------
Ran 7 tests in 4.727s

OK
Testing adding a listing with invalid attributes
Testing adding a listing with valid attributes
testing getting the feed while authenticated
testing getting the feed while unauthorized
testing getting an item
tetsting getting the listing
testing getting the index
Name Stmts Miss Cover
--------------------------------------------------------------
ss-ase/app/__init__.py 12 0 100%
ss-ase/app/feed_module/__init__.py 0 0 100%
ss-ase/app/feed_module/controllers.py 80 41 49%
ss-ase/app/feed_module/models.py 9 0 100%
ss-ase/app/login/__init__.py 0 0 100%
ss-ase/app/login/controllers.py 37 1 97%
ss-ase/app/login/forms.py 14 0 100%
ss-ase/app/login/models.py 23 1 96%
ss-ase/config.py 6 0 100%
ss-ase/test_listing.py 76 0 100%
ss-ase/test_login.py 58 0 100%
--------------------------------------------------------------
TOTAL 315 43 86%
[localhost] local: coverage run --rcfile=.coveragerc ./ss-ase/test_login.py
[localhost] local: coverage run --rcfile=.coveragerc -a ./ss-ase/test_listing.py
[localhost] local: coverage report > coverage.txt
[localhost] local: coverage report

Done.

0 comments on commit 5044c99

Please sign in to comment.