MERGE WARNING!!
deleted CourseAPI_test from my rep. i think this file doesnt exist in @etyemy rep aswell
This commit is contained in:
parent
695d052cf0
commit
18ad25f18d
1 changed files with 44 additions and 50 deletions
|
@ -3,8 +3,7 @@ import unittest
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
from Testing.config import __CONFIG__
|
from Testing.config import __CONFIG__
|
||||||
|
class CoursesTestPlan(unittest.TestCase):
|
||||||
class UserTestPlan(unittest.TestCase):
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
debug = __CONFIG__['DEBUG']
|
debug = __CONFIG__['DEBUG']
|
||||||
|
@ -17,80 +16,75 @@ class UserTestPlan(unittest.TestCase):
|
||||||
if 200 <= request.status_code <= 299:
|
if 200 <= request.status_code <= 299:
|
||||||
print 'Initialized'
|
print 'Initialized'
|
||||||
|
|
||||||
def test_courseCreate_lecturer(self):
|
def test_coursesCreate_Lecturer(self):
|
||||||
#url = "http://localhost:8080/api/courses/create/_QA_TOKEN_TEST_LECTURER"
|
headers = {'content-type': 'application/json'}
|
||||||
url=self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['LECTURER']
|
url = 'http://se-hub.appspot.com/api/courses/create/_QA_TOKEN_TEST_LECTURER'
|
||||||
|
params = {'seToken': 'seToken' }
|
||||||
data = {
|
data = {
|
||||||
'courseName': 'matan',
|
'courseName': 'QA COURSE',
|
||||||
'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg',
|
'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg',
|
||||||
'projects': '@gay.lord.ultima.multi.omega',
|
'projects': '@gay.lord.ultima.multi.omega',
|
||||||
'startDate': {'year': 2015, 'month' : 4, 'day' : 3},
|
'startDate': {'year': 2015, 'month' : 4, 'day' : 3},
|
||||||
'endDate': {'year': 2016,'month' : 6,'day' : 6}
|
'endDate': {'year': 2016,'month' : 6,'day' : 6}
|
||||||
}
|
}
|
||||||
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
|
||||||
r = requests.post(url, data=json.dumps(data), headers=headers)
|
|
||||||
self.assertEquals(r.status_code, 201)
|
|
||||||
|
|
||||||
def test_courseCreate_lecturerExsistingCourse(self):
|
#r = requests.post(self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['STUDENT'],data=payload)
|
||||||
#url = "http://localhost:8080/api/courses/create/_QA_TOKEN_TEST_LECTURER"
|
r = requests.post(url, params=params, data=json.dumps(data), headers=headers)
|
||||||
url=self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['LECTURER']
|
'''
|
||||||
data = {
|
payload = {
|
||||||
'courseName': 'matan',
|
'courseName': 'QA COURSE',
|
||||||
'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg',
|
'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg',
|
||||||
'projects': '@gay.lord.ultima.multi.omega',
|
'projects': '@gay.lord.ultima.multi.omega',
|
||||||
'startDate': {'year': 2015, 'month' : 4, 'day' : 3},
|
'startDate': {'year': 2015, 'month' : 4, 'day' : 3},
|
||||||
'endDate': {'year': 2016,'month' : 6,'day' : 6}
|
'endDate': {'year': 2016,'month' : 6,'day' : 6}
|
||||||
}
|
}
|
||||||
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
'''
|
||||||
r = requests.post(url, data=json.dumps(data), headers=headers)
|
# r = requests.post(self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['LECTURER'],data=payload)
|
||||||
|
#r = requests.post('http://localhost:8080/api/courses/create/_QA_TOKEN_TEST_LECTURER',data=payload)
|
||||||
|
#self.assertEquals(r.status_code, 201)
|
||||||
|
|
||||||
|
def test_coursesCreate_InvalidToken(self):
|
||||||
|
headers = {'content-type': 'application/json'}
|
||||||
|
url = self.__class__.url_+'api/courses/create/invalidToken'
|
||||||
|
data = {
|
||||||
|
'courseName': 'QA COURSE',
|
||||||
|
'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg',
|
||||||
|
'projects': '@gay.lord.ultima.multi.omega',
|
||||||
|
'startDate': {'year': 2015, 'month' : 4, 'day' : 3},
|
||||||
|
'endDate': {'year': 2016,'month' : 6,'day' : 6}
|
||||||
|
}
|
||||||
|
params = {'seToken': 'seToken' }
|
||||||
|
r = requests.post(url, params=params, data=json.dumps(data), headers=headers)
|
||||||
self.assertEquals(r.status_code, 403)
|
self.assertEquals(r.status_code, 403)
|
||||||
|
'''
|
||||||
def test_courseCreate_student(self):
|
payload = {'courseName': 'Advance Math', 'campusName': 'JCE', 'startDate':'2015-14-3','endDate': '2015-29-6','taskFlag': 'False'}
|
||||||
#url = "http://localhost:8080/api/courses/create/_QA_TOKEN_TEST_LECTURER"
|
payload = {
|
||||||
url=self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['STUDENT']
|
'courseName': 'QA COURSE',
|
||||||
data = {
|
|
||||||
'courseName': 'matan',
|
|
||||||
'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg',
|
'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg',
|
||||||
'projects': '@gay.lord.ultima.multi.omega',
|
'projects': '@gay.lord.ultima.multi.omega',
|
||||||
'startDate': {'year': 2015, 'month' : 4, 'day' : 3},
|
'startDate': {'year': 2015, 'month' : 4, 'day' : 3},
|
||||||
'endDate': {'year': 2016,'month' : 6,'day' : 6}
|
'endDate': {'year': 2016,'month' : 6,'day' : 6}
|
||||||
}
|
}
|
||||||
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
r = requests.post(self.__class__.url_+'api/courses/create/invalidToken',data=payload)
|
||||||
r = requests.post(url, data=json.dumps(data), headers=headers)
|
'''
|
||||||
self.assertEquals(r.status_code, 403)
|
def test_coursesCreate_Student(self):
|
||||||
|
headers = {'content-type': 'application/json'}
|
||||||
def test_courseCreate_invalidToken(self):
|
url = self.__class__.url_+'api/courses/create/_QA_TOKEN_TEST_STUDENT'
|
||||||
#url = "http://localhost:8080/api/courses/create/_QA_TOKEN_TEST_LECTURER"
|
params = {'seToken': 'seToken' }
|
||||||
url=self.__class__.url_+'api/courses/create/invalidToken'
|
|
||||||
data = {
|
data = {
|
||||||
'courseName': 'matan',
|
'courseName': 'QA COURSE',
|
||||||
'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg',
|
'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg',
|
||||||
'projects': '@gay.lord.ultima.multi.omega',
|
'projects': '@gay.lord.ultima.multi.omega',
|
||||||
'startDate': {'year': 2015, 'month' : 4, 'day' : 3},
|
'startDate': {'year': 2015, 'month' : 4, 'day' : 3},
|
||||||
'endDate': {'year': 2016,'month' : 6,'day' : 6}
|
'endDate': {'year': 2016,'month' : 6,'day' : 6}
|
||||||
}
|
}
|
||||||
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
|
||||||
r = requests.post(url, data=json.dumps(data), headers=headers)
|
|
||||||
self.assertEquals(r.status_code, 403)
|
|
||||||
|
|
||||||
def test_courseCreate_hebrewToken(self):
|
#r = requests.post(self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['STUDENT'],data=payload)
|
||||||
#url = "http://localhost:8080/api/courses/create/_QA_TOKEN_TEST_LECTURER"
|
r = requests.post(url, params=params, data=json.dumps(data), headers=headers)
|
||||||
url=self.__class__.url_+'api/courses/create/????'
|
self.assertEquals(r.status_code, 403, 'message: ' + r.json()['message'])
|
||||||
data = {
|
|
||||||
'courseName': 'matan',
|
|
||||||
'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg',
|
|
||||||
'projects': '@gay.lord.ultima.multi.omega',
|
|
||||||
'startDate': {'year': 2015, 'month' : 4, 'day' : 3},
|
|
||||||
'endDate': {'year': 2016,'month' : 6,'day' : 6}
|
|
||||||
}
|
|
||||||
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
|
||||||
r = requests.post(url, data=json.dumps(data), headers=headers)
|
|
||||||
self.assertEquals(r.status_code, 404)
|
|
||||||
|
|
||||||
#/api/courses/getCourseByCampusName/<string:name>
|
def test_getCourseByCampusName(self):
|
||||||
def test_getCourseByCampusName_EXSISTING_CAMPUS(self):
|
r = requests.get(self.__class__.url_+'api/courses/getCourseByCampusName/'+__CONFIG__['TOKENS']['CAMPUS_NAME'])
|
||||||
url=self.__class__.url_+'api/courses/getCourseByCampusName/'+__CONFIG__['CAMPUS_NAME']['JCE']
|
|
||||||
r = requests.get(url)
|
|
||||||
self.assertEquals(r.status_code, 200)
|
self.assertEquals(r.status_code, 200)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue