From a943d370d122dea79ade28a246bc22b097ec3836 Mon Sep 17 00:00:00 2001 From: etyemyer Date: Mon, 15 Jun 2015 22:21:07 +0300 Subject: [PATCH] UserApi_Test - test getuserbytoken with valid,invalid and empty string CampusesApi_test - with valid,invalid string --- Testing/CampusAPI_Test.py | 2 +- Testing/CoursesAPI_Test.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 Testing/CoursesAPI_Test.py diff --git a/Testing/CampusAPI_Test.py b/Testing/CampusAPI_Test.py index 09be45d..ee40022 100644 --- a/Testing/CampusAPI_Test.py +++ b/Testing/CampusAPI_Test.py @@ -2,7 +2,7 @@ __author__ = 'etye' import unittest import requests from Testing.config import __CONFIG__ -class UserTestPlan(unittest.TestCase): +class CampusTestPlan(unittest.TestCase): @classmethod def setUpClass(cls): debug = __CONFIG__['DEBUG'] diff --git a/Testing/CoursesAPI_Test.py b/Testing/CoursesAPI_Test.py new file mode 100644 index 0000000..1625cde --- /dev/null +++ b/Testing/CoursesAPI_Test.py @@ -0,0 +1,32 @@ +__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() \ No newline at end of file