QA: Update UserAPI_Test.py to new API scheme
This commit is contained in:
parent
97af27500d
commit
2dc319af48
1 changed files with 12 additions and 3 deletions
|
@ -17,18 +17,27 @@ class UserTestPlan(unittest.TestCase):
|
||||||
print 'Initialized'
|
print 'Initialized'
|
||||||
|
|
||||||
def test_getUserByToken_invalid(self):
|
def test_getUserByToken_invalid(self):
|
||||||
r = requests.get(self.__class__.url_+'api/getUserByToken/invalidtoken')
|
r = requests.get(self.__class__.url_+'api/users/getUserByToken/invalidtoken')
|
||||||
self.assertEquals(r.status_code, 403)
|
self.assertEquals(r.status_code, 403)
|
||||||
|
|
||||||
def test_getUserByToken_valid(self):
|
def test_getUserByToken_valid(self):
|
||||||
r = requests.get(self.__class__.url_+'api/getUserByToken/'+__CONFIG__['TOKENS']['STUDENT'])
|
r = requests.get(self.__class__.url_+'api/users/getUserByToken/'+__CONFIG__['TOKENS']['STUDENT'])
|
||||||
self.assertEquals(r.status_code, 200)
|
self.assertEquals(r.status_code, 200)
|
||||||
self.assertEquals(r.json()['username'], 'qa_student')
|
self.assertEquals(r.json()['username'], 'qa_student')
|
||||||
|
|
||||||
def test_getUserByToken_empty(self):
|
def test_getUserByToken_empty(self):
|
||||||
r = requests.get(self.__class__.url_+'api/getUserByToken/')
|
r = requests.get(self.__class__.url_+'api/users/getUserByToken/')
|
||||||
self.assertEquals(r.status_code, 400)
|
self.assertEquals(r.status_code, 400)
|
||||||
|
|
||||||
|
def test_isStudent_Student(self):
|
||||||
|
r = requests.get(self.__class__.url_+'api/users/getUserByToken/'+__CONFIG__['TOKENS']['STUDENT'])
|
||||||
|
self.assertEquals(r.status_code, 200)
|
||||||
|
self.assertFalse(r.json()['isLecturer'])
|
||||||
|
|
||||||
|
def test_isLecturer_Lecturer(self):
|
||||||
|
r = requests.get(self.__class__.url_+'api/users/getUserByToken/'+__CONFIG__['TOKENS']['LECTURER'])
|
||||||
|
self.assertEquals(r.status_code, 200)
|
||||||
|
self.assertTrue(r.json()['isLecturer'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue