def test_view_widgets(self): # this test 3 valued widgets where valid values are 'yes', 'no' or '-' # '-' is shown when no value given client = self.app.test_client() with self.app.test_request_context(): session = database.get_session() row = database.ReportRow() row.update(self.report_data) session.save(row) session.commit() view_response = client.get('/reports/%s/' % row.id) # clone self.report_data dict data = dict(self.report_data) del data[u'details_publisher'] with self.app.test_request_context(): session = database.get_session() row.update(data) session.save(row) session.commit() # no value given, look for '-' label = 'Published by' value = '-' self.assertTrue( common.search_label_value(label, value, view_response.data))
def test_view_widgets(self): # this test 3 valued widgets where valid values are 'yes', 'no' or '-' # '-' is shown when no value given client = self.app.test_client() with self.app.test_request_context(): session = database.get_session() row = database.ReportRow() row.update(self.report_data) session.save(row) session.commit() view_response = client.get('/reports/%s/' %row.id) # clone self.report_data dict data = dict(self.report_data) del data[u'details_publisher'] with self.app.test_request_context(): session = database.get_session() row.update(data) session.save(row) session.commit() # no value given, look for '-' label = 'Published by' value = '-' self.assertTrue(common.search_label_value(label, value, view_response.data))
def test_update(self): #NOTE this tests both report and seris client = self.app.test_client() with self.app.test_request_context(): session = database.get_session() row = database.ReportRow() row.update(self.report_data) session.save(row) session.commit() # clone self.report_data dict data = dict(self.report_data) #add additional info data.update({u'format_no_of_pages': u'2303445'}) #update existing info data.update({u'header_uploader': u'Jerry Seinfeld'}) #remove info del data[u'links_reference_global_level'] edit_response = client.post('/reports/%s/edit/' % row.id, data=data, follow_redirects=True) # checking correct flash message self.assertIn("Report saved.", edit_response.data) # checking additional info self.assertIn("2303445", edit_response.data) # checking existing info update self.assertIn("Jerry Seinfeld", edit_response.data) # checking now if the checkbox has changed to No label = "Global-level SOER.+s?" value = 'No' self.assertTrue( common.search_label_value(label, value, edit_response.data))
def test_update(self): #NOTE this tests both report and seris client = self.app.test_client() with self.app.test_request_context(): session = database.get_session() row = database.ReportRow() row.update(self.report_data) session.save(row) session.commit() # clone self.report_data dict data = dict(self.report_data) #add additional info data.update({u'format_no_of_pages': u'2303445'}) #update existing info data.update({u'header_uploader': u'Jerry Seinfeld'}) #remove info del data[u'links_reference_global_level'] edit_response = client.post('/reports/%s/edit/' %row.id, data = data, follow_redirects=True) # checking correct flash message self.assertIn("Report saved.", edit_response.data) # checking additional info self.assertIn("2303445", edit_response.data) # checking existing info update self.assertIn("Jerry Seinfeld", edit_response.data) # checking now if the checkbox has changed to No label = "Global-level SOER.+s?" value = 'No' self.assertTrue(common.search_label_value(label, value, edit_response.data))