def test_speaker(self): speaker = POST_SPEAKER_DATA.copy() SPEAKER_FORM['github']['require'] = 1 speaker['github'] = None form_str = json.dumps(SPEAKER_FORM, separators=(',', ':')) with app.test_request_context(): update_or_create(CustomForms, event_id=1, speaker_form=form_str) path = get_path(1, 'speakers') resp = self.post(path, speaker) self.assertEqual(resp.status_code, 400)
def test_session(self): session = POST_SESSION_DATA.copy() SESSION_FORM['comments']['require'] = 1 session['comments'] = None form_str = json.dumps(SESSION_FORM, separators=(',', ':')) with app.test_request_context(): update_or_create(CustomForms, event_id=1, session_form=form_str) path = get_path(1, 'sessions') resp = self.post(path, session) self.assertEqual(resp.status_code, 400)
def create(self, event_id, data, url): data = self.validate(data) return update_or_create(self.model, event_id=event_id, **data)