def _confirm_add_equipment_clicked(self, widget): #FIXME input validation for numeric fields description = gtk_str( self._builder.get_object( "entryEquipmentAddDescription").get_text()) life_expectancy = gtk_str( self._builder.get_object( "entryEquipmentAddLifeExpectancy").get_text()) prior_usage = gtk_str( self._builder.get_object("entryEquipmentAddPriorUsage").get_text()) active = self._builder.get_object( "checkbuttonEquipmentAddActive").get_active() notes_buffer = self._builder.get_object( "textviewEquipmentAddNotes").get_buffer() notes = gtk_str( notes_buffer.get_text(notes_buffer.get_start_iter(), notes_buffer.get_end_iter(), True)) new_equipment = Equipment() new_equipment.description = description new_equipment.active = bool(active) new_equipment.life_expectancy = int(life_expectancy) new_equipment.prior_usage = int(prior_usage) new_equipment.notes = notes self._equipment_store.add_equipment(new_equipment) self.show_page_equipment_list()
def test_active_set_to_non_boolean(self): equipment = Equipment() try: equipment.active = "test" except (TypeError): pass else: self.fail("Should not be able to set active to non-boolean value.")
def test_get_item_active(self): equipment = Equipment() equipment.id = 1 equipment.active = False self.mock_equipment_service.get_all_equipment.return_value = [equipment] equipment_store = EquipmentStore(self.mock_equipment_service) iter = equipment_store.get_iter_first() self.assertFalse(equipment_store.get_value(iter, 4))
def test_active_set_to_non_boolean(self): equipment = Equipment() try: equipment.active = "test" except(TypeError): pass else: self.fail("Should not be able to set active to non-boolean value.")
def test_active_set_to_non_boolean(self): equipment = Equipment() equipment.active = "test" self.ddbb.session.add(equipment) try: self.ddbb.session.commit() self.assertTrue(equipment.active) except StatementError: pass
def test_get_item_active(self): equipment = Equipment() equipment.id = 1 equipment.active = False self.mock_equipment_service.get_all_equipment.return_value = [ equipment ] equipment_store = EquipmentStore(self.mock_equipment_service) iter = equipment_store.get_iter_first() self.assertFalse(equipment_store.get_value(iter, 4))
def _confirm_add_equipment_clicked(self, widget): #FIXME input validation for numeric fields description = self._builder.get_object("entryEquipmentAddDescription").get_text() life_expectancy = self._builder.get_object("entryEquipmentAddLifeExpectancy").get_text() prior_usage = self._builder.get_object("entryEquipmentAddPriorUsage").get_text() active = self._builder.get_object("checkbuttonEquipmentAddActive").get_active() notes_buffer = self._builder.get_object("textviewEquipmentAddNotes").get_buffer() notes = notes_buffer.get_text(notes_buffer.get_start_iter(), notes_buffer.get_end_iter()) new_equipment = Equipment() new_equipment.description = unicode(description) new_equipment.active = active new_equipment.life_expectancy = life_expectancy new_equipment.prior_usage = prior_usage new_equipment.notes = unicode(notes) self._equipment_store.add_equipment(new_equipment) self.show_page_equipment_list()
def _confirm_add_equipment_clicked(self, widget): #FIXME input validation for numeric fields description = gtk_str(self._builder.get_object("entryEquipmentAddDescription").get_text()) life_expectancy = gtk_str(self._builder.get_object("entryEquipmentAddLifeExpectancy").get_text()) prior_usage = gtk_str(self._builder.get_object("entryEquipmentAddPriorUsage").get_text()) active = self._builder.get_object("checkbuttonEquipmentAddActive").get_active() notes_buffer = self._builder.get_object("textviewEquipmentAddNotes").get_buffer() notes = gtk_str(notes_buffer.get_text(notes_buffer.get_start_iter(), notes_buffer.get_end_iter(), True)) new_equipment = Equipment() new_equipment.description = description new_equipment.active = bool(active) new_equipment.life_expectancy = int(life_expectancy) new_equipment.prior_usage = int(prior_usage) new_equipment.notes = notes self._equipment_store.add_equipment(new_equipment) self.show_page_equipment_list()
def _confirm_add_equipment_clicked(self, widget): #FIXME input validation for numeric fields description = self._builder.get_object( "entryEquipmentAddDescription").get_text() life_expectancy = self._builder.get_object( "entryEquipmentAddLifeExpectancy").get_text() prior_usage = self._builder.get_object( "entryEquipmentAddPriorUsage").get_text() active = self._builder.get_object( "checkbuttonEquipmentAddActive").get_active() notes_buffer = self._builder.get_object( "textviewEquipmentAddNotes").get_buffer() notes = notes_buffer.get_text(notes_buffer.get_start_iter(), notes_buffer.get_end_iter()) new_equipment = Equipment() new_equipment.description = unicode(description) new_equipment.active = active new_equipment.life_expectancy = life_expectancy new_equipment.prior_usage = prior_usage new_equipment.notes = unicode(notes) self._equipment_store.add_equipment(new_equipment) self.show_page_equipment_list()
def test_active_set_to_boolean(self): equipment = Equipment() equipment.active = False self.assertFalse(equipment.active)