def test_schedulecontrol_put_privacy(self): self.session = self.createAuthorizedSession(control.username, control.password) self.url = control.hostURL + 'api/schedulecontrol/privacy/N/' response = api.put(self.session, self.url, 'N') if not response.status_code == 200: pytest.fail('Expected 200 OK, got {0}.'\ .format(response.status_code)) self.url = control.hostURL + 'api/schedulecontrol/' response = api.get(self.session, self.url) if not response.status_code == 200: pytest.fail('Expected 200 OK, got {0}.'\ .format(response.status_code)) assert response.json()["IsSchedulePrivate"] == False self.url = self.url + 'privacy/Y/' response = api.put(self.session, self.url, 'Y') if not response.status_code == 200: pytest.fail('Expected 200 OK, got {0}.'\ .format(response.status_code)) self.url = control.hostURL + 'api/schedulecontrol/' response = api.get(self.session, self.url) if not response.status_code == 200: pytest.fail('Expected 200 OK, got {0}.'\ .format(response.status_code)) assert response.json()["IsSchedulePrivate"] == True
def test_put_social_media_links(self): self.session = self.createAuthorizedSession(control.username, control.password) self.url = control.hostURL + 'api/profiles/facebook/' self.data = { 'facebook': 'https://www.facebook.com/360.studenttest' #'URL of any SNS including the domain name' } response = api.put(self.session, self.url, self.data) if not response.status_code == 200: pytest.fail('Expected 200 OK, got {0}.'\ .format(response.status_code)) self.resetdata = { 'facebook': 'Changed for testing' } d = api.put(self.session, self.url, self.resetdata) if not d.status_code == 200: pytest.fail('There was a problem performing cleanup')
def test_put_apartment_application(self): self.session = self.createAuthorizedSession(control.username, control.password) self.url = control.hostURL + 'api/housing/putApartmentApplication' self.data = {'ID': control.my_id_number} self.requestID = -1 response = api.put(self.session, self.url, self.data) if not response.status_code == 200: pytest.fail('Expected 200 OK, got {0}.'\ .format(response.status_code))
def test_put_mobile_privacy(self): self.session = self.createAuthorizedSession(control.username, control.password) self.url = control.hostURL + 'api/profiles/mobile_privacy/Y/' self.data = { 'IsMobilePhonePrivate': 'Y' } response = api.put(self.session, self.url, self.data) if not response.status_code == 200: pytest.fail('Expected 200 OK, got {0}.'\ .format(response.status_code)) profile_url = control.hostURL + 'api/profiles/' check_response = api.get(self.session,profile_url) assert check_response.json()['IsMobilePhonePrivate'] == 1 self.url = control.hostURL + 'api/profiles/mobile_privacy/N/' self.resetdata = { 'IsMobilePhonePrivate': 'N' } d = api.put(self.session, self.url, self.resetdata) if not d.status_code == 200: pytest.fail('There was a problem performing cleanup') check_response = api.get(self.session,profile_url) assert check_response.json()['IsMobilePhonePrivate'] == 0
def test_put_guest_social_media_links(self): self.session = self.createGuestSession() self.url = control.hostURL + 'api/profiles/facebook/' self.data = { 'facebook': 'https://www.facebook.com/360.studenttest' } response = api.put(self.session, self.url, self.data) if not response.status_code == 401: pytest.fail('Expected 401 OK, got {0}.'\ .format(response.status_code)) try: assert response.json()['Message'] == control.AUTHORIZATION_DENIED except ValueError: pytest.fail('Expected Json response body, got{0}.'\ .format(response.text))
def test_put_edit_apartment_application__editor(self): self.session = self.createAuthorizedSession(control.username, control.password) self.url = control.hostURL + 'api/housing/apartment/save' self.data = {'ID': control.my_id_number} response = api.put(self.session, self.url, self.data) # Sudo code # First, create an authorized session and check if the student is the editor # If editor, call the save api to save the application. (accesses the database) # No additional applicant or hall preference is added. if not response.status_code == 201: pytest.fail('Expected 201 Created, got {0}.'\ .format(response.status_code))
def test_schedulecontrol_put_description(self): self.session = self.createAuthorizedSession(control.username, control.password) self.url = control.hostURL + 'api/schedulecontrol/description/' + \ control.put_description + '/' response = api.put(self.session, self.url, control.put_description) if not response.status_code == 200: pytest.fail('Expected 200 OK, got {0}.'\ .format(response.status_code)) self.url = control.hostURL + 'api/schedulecontrol/' response = api.get(self.session, self.url) if not response.status_code == 200: pytest.fail('Expected 200 OK, got {0}.'\ .format(response.status_code)) assert response.json()["Description"] == control.put_description
def test_date_submitted_changed(self): self.session = self.createAuthorizedSession(control.username, control.password) self.url = control.hostURL + 'api/housing/apartment/applications' self.data = { 'ApplicationID': -1, 'EditorProfile': { 'AD_Username': control.leader_username, }, 'Applicants': [ { 'Profile': { 'AD_Username': control.leader_username, 'Class': 'Junior', }, }, ], 'ApartmentChoices': [ { 'HallRank': 1, 'HallName': 'Tavilla' }, ], } appIDResponse = api.postAsJson(self.session, self.url, self.data) appID = appIDResponse.content self.url = control.hostURL + 'api/housing/apartment/applications/' + str( appID) + '/submit' self.data = {} response = api.put(self.session, self.url, self.data) if not response.status_code == 200: pytest.fail('Expected 200 OK, got {0}.'\ .format(response.status_code)) # clean up self.url = control.hostURL + 'api/housing/apartment/applications/' + str( appID) response = api.delete(self.session, self.url)