def add_rockets() -> None: """ Add rockets :return: None """ app.add_new_rocket('falcon1', 600) app.add_new_rocket('falcon9', 22800)
def menu_add_new_rocket() -> None: from app import add_new_rocket is_valid = False print_header("Add new rocket") while not is_valid: try: # The user introduce the data rocket_id = input("rocket id: ") rocket_payload = validate_integer("rocket payload") # Add the new rocket add_new_rocket(rocket_id, rocket_payload) is_valid = True except ValueError as error: print_error(str(error))
def test_invalid_rocket_payload_must_raise_value_error(self): # assert with self.assertRaises(ValueError): app.add_new_rocket('123ABC', 'invalid payload')
def test_rocket_id_already_exists_must_raise_value_error(self): # assert with self.assertRaises(ValueError): app.add_new_rocket('abc', 200) app.add_new_rocket('abc', 200)
def test_invalid_rocket_id_must_raise_value_error(self): # assert with self.assertRaises(ValueError): app.add_new_rocket('x', 200)
def test_a_mission_should_have_a_valid_days_to_arrive(self): # assert with self.assertRaises(ValueError): app.add_new_rocket('rocket_123', 200) app.add_new_mission('m01', 'rocket_123', 'bad_days')
def test_a_mission_should_have_a_valid_rocket_id(self): # assert with self.assertRaises(ValueError): app.add_new_rocket('rocket_123', 200) app.add_new_mission('m01', 'invalid_rocket_id', 10)