def test_user_name_forbidden_symbols_6(self): user = User('user', Color.RED) settings_menu = SettingsMenu(10, 10, user, None) settings_menu.textBoxDict['Name'].text = '*****@*****.**' settings_menu.validate() self.assertEqual( settings_menu.get_status_box('status').text, settings_menu.FORBIDDEN_SYMBOLS_ERROR_MSG)
def test_user_name_blank(self): user = User('user', Color.RED) settings_menu = SettingsMenu(10, 10, user, None) settings_menu.textBoxDict['Name'].text = '' settings_menu.validate() self.assertEqual( settings_menu.get_status_box('status').text, settings_menu.BLANK_ERROR_MSG)
def test_user_name_starts_with_digits(self): user = User('user', Color.RED) settings_menu = SettingsMenu(10, 10, user, None) settings_menu.textBoxDict['Name'].text = '1qwertt' settings_menu.validate() self.assertEqual( settings_menu.get_status_box('status').text, settings_menu.START_WITH_DIGIT_ERROR_MSG)
def test_user_name_maximum_length(self): user = User('user', Color.RED) settings_menu = SettingsMenu(10, 10, user, None) settings_menu.textBoxDict['Name'].text = 'qwertyuiopasdfghj' settings_menu.validate() self.assertEqual( settings_menu.get_status_box('status').text, settings_menu.MORE_THAN_MAX_CHAR_ERROR_MSG)
def test_user_name_minimum_length(self): user = User('user', Color.RED) settings_menu = SettingsMenu(10, 10, user, None) settings_menu.textBoxDict['Name'].text = 'us' settings_menu.validate() self.assertEqual( settings_menu.get_status_box('status').text, settings_menu.LESS_THAN_MIN_CHAR_ERROR_MSG)
def test_user_settings_save(self): user = User('user', Color.RED) settings_menu = SettingsMenu(10, 10, user, lambda: print('')) settings_menu.textBoxDict['Name'].text = 'GalconPlayer' settings_menu.get_color_button().color_p = Color.PURPLE settings_menu.validate() self.assertEqual(settings_menu.user.name, settings_menu.get_text_box('Name')) self.assertEqual(settings_menu.user.color, Color.PURPLE)