Skip to content

Commit

Permalink
Revert "Tests Python"
Browse files Browse the repository at this point in the history
This reverts commit d843743.
  • Loading branch information
jonthemango committed Mar 22, 2018
1 parent 2b737ce commit 2454060
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 35 deletions.
2 changes: 1 addition & 1 deletion application/api/qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def questionsRoute():
status = 'OK'
message = 'List of several questions by user_id'
elif 'engineer' in questionArgs:
questions = Questions.getQuestionsByEngineer(questionArgs['engineer'], id)
questions = Questions.getQuestionByEngineer(questionArgs['engineer'], id)
success = True
status = 'OK'
message = 'List of several questions by engineer'
Expand Down
4 changes: 2 additions & 2 deletions application/models/Questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def deleteQuestion(id):
return response


### NOT USED
# NOT SURE IF WORKS, SHOULD BE TESTED
def modifyQuestion(id, title, text, engineer):
response = False
question = getQuestion(id)
Expand Down Expand Up @@ -180,7 +180,7 @@ def getQuestionsByUser(user_id, loggedin_id):


# Get all Question returns list of users or an empty list
def getQuestionsByEngineer(engineer, loggedin_id):
def getQuestionByEngineer(engineer, loggedin_id):
from application.models import Users
from application.models import Votes
response = []
Expand Down
39 changes: 7 additions & 32 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,12 @@


def test_questions():


# create test user
Users.createUser("Mark", "Hamill", "starwarsfan", "wookie", "Space", "chewbaca", True)
id = getUserId("starwarsfan")

if questions.questionExists(1):
Questions.createQuestion("Question", "Please Answer", "software", 1)
questions = Questions.getQuestionsByUser(1, 0)
if questions:
return 0
else:
return 1



Questions.createQuestion("Question", "Please Answer", "software", id)
questions = Questions.getQuestionsByUser(id, 0)
if not questions:
return 2

question = Questions.getQuestion(1)
if not question:
return 3

Questions.updateTags(1, "tag1 tag2 tag3")

if question.tags != "tag1 tag2 tag3":
return 4

if Questions.getQuestionsByEngineer('software', id):
return 5

if not Questions.deleteQuestion(1):
return 6

return 0


Expand All @@ -55,7 +30,7 @@ def test_users():
return 1
if Users.userVerified("starwarsfan", "wookie"):
return 2
if Users.modifyUser(1, "Boba", "Fett", "Killer"):
if Users.modifyUser(1, "Boba", "Fett", "Killer", "starwarsfan"):
return 3

# test with existing user
Expand All @@ -75,7 +50,7 @@ def test_users():
return 8
if user["password_hash"] == "wookie":
return 9
if not Users.modifyUser(user["id"], "Han", "Solo", "Ship"):
if not Users.modifyUser(user["id"], "Han", "Solo", "Ship", "starwarsfan"):
return 10
user = Users.getUser("starwarsfan")
if user["fname"] != "Han" or user["lname"] != "Solo" or user["engineer"] != "Ship":
Expand Down

0 comments on commit 2454060

Please sign in to comment.