def testGetNumberOfSubmissions(self): survey_id = connection.execute(survey_table.select().where( survey_table.c.survey_title == 'test_title')).first().survey_id submission_exec = connection.execute( submission_insert(submitter='test_submitter', submitter_email='*****@*****.**', survey_id=survey_id)) submission_id = submission_exec.inserted_primary_key[0] connection.execute(submission_table.select().where( submission_table.c.submission_id == submission_id)) self.assertEqual(get_number_of_submissions(connection, survey_id), 1)
def testSubmissionInsert(self): survey_id = connection.execute(survey_table.select().where( survey_table.c.survey_title == 'test_title')).first().survey_id submission_exec = connection.execute(submission_insert( submitter='test_submitter', submitter_email='*****@*****.**', survey_id=survey_id)) submission_id = submission_exec.inserted_primary_key[0] sub_exec = connection.execute(submission_table.select().where( submission_table.c.submission_id == submission_id)) submission = sub_exec.first() self.assertEqual(submission_id, submission.submission_id)