a943d370d1
CampusesApi_test - with valid,invalid string
32 lines
No EOL
1.1 KiB
Python
32 lines
No EOL
1.1 KiB
Python
__author__ = 'etye'
|
|
import unittest
|
|
import requests
|
|
from Testing.config import __CONFIG__
|
|
class CoursesTestPlan(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
debug = __CONFIG__['DEBUG']
|
|
if debug:
|
|
url = __CONFIG__['PATHS']['DEBUG']
|
|
else:
|
|
url = __CONFIG__['PATHS']['PRODUCTION']
|
|
cls.url_ = url
|
|
request = requests.get(url+'api/qa/init')
|
|
if 200 <= request.status_code <= 299:
|
|
print 'Initialized'
|
|
|
|
def test_coursesCreate_Lecturer(self):
|
|
r = requests.get(self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['LECTURER'])
|
|
self.assertEquals(r.status_code, 201)
|
|
|
|
def test_coursesCreate_InvalidToken(self):
|
|
r = requests.get(self.__class__.url_+'api/courses/create/invalidToken')
|
|
self.assertEquals(r.status_code, 403)
|
|
|
|
def test_coursesCreate_Student(self):
|
|
r = requests.get(self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['STUDENT'])
|
|
self.assertEquals(r.status_code, 403)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main() |