Ejemplo n.º 1
0
 def test_invalid_character_name(self):
     user_input = '!add Moo+s tos 5'
     message = DiscordMessage(user_input)
     ctx = DiscordCtx(message)
     error = insert_keystone(ctx, self.db_manager, *message.get_args())
     self.assertEqual(
         error, f'Character names can only contain letters, '
         f'numbers, underscores, and dashes.')
Ejemplo n.º 2
0
 def test_invalid_num_args(self):
     user_input = '!add Moo Too'
     message = DiscordMessage(user_input)
     ctx = DiscordCtx(message)
     error = insert_keystone(ctx, self.db_manager, *message.get_args())
     self.assertEqual(
         error, 'I\'m sorry, I didn\'t understand that. Try '
         '`!help add` for help with formatting.')
Ejemplo n.º 3
0
 def test_db_error(self):
     self.db_manager.add_keystone = MagicMock(return_value=False)
     user_input = '!add Moo Waycrest 10'
     message = DiscordMessage(user_input)
     ctx = DiscordCtx(message)
     error = insert_keystone(ctx, self.db_manager, *message.get_args())
     self.assertEqual(
         error, 'There was a problem adding Waycrest Manor '
         '+10 for Moo.')
Ejemplo n.º 4
0
 def test_backticks_invalid_dungeon(self):
     user_input = '!add Moo `Fake Dungeon`` 10'
     message = DiscordMessage(user_input)
     ctx = DiscordCtx(message)
     error = insert_keystone(ctx, self.db_manager, *message.get_args())
     self.assertEqual(
         error, f'I\'m sorry, I didn\'t understand the dungeon '
         f'`Fake Dungeon`. Try `!dungeons` to see '
         f'dungeon names.')
Ejemplo n.º 5
0
 def test_no_character_name(self):
     user_input = '!add Temple of Sethraliss 10'
     message = DiscordMessage(user_input)
     ctx = DiscordCtx(message)
     error = insert_keystone(ctx, self.db_manager, *message.get_args())
     self.assertEqual(
         error, f'I\'m sorry, I didn\'t understand the dungeon '
         f'`of Sethraliss`. Try `!dungeons` to see '
         f'dungeon names.')
Ejemplo n.º 6
0
 def test_backticks_invalid_level(self):
     user_input = '!add Moo Temple of Sethraliss `Bad`Level`'
     message = DiscordMessage(user_input)
     ctx = DiscordCtx(message)
     error = insert_keystone(ctx, self.db_manager, *message.get_args())
     self.assertEqual(error, f'`BadLevel` isn\'t a valid dungeon level.')
Ejemplo n.º 7
0
 def test_insert_less_than_2_level(self):
     user_input = '!add Moo Waycrest NaN'
     message = DiscordMessage(user_input)
     ctx = DiscordCtx(message)
     error = insert_keystone(ctx, self.db_manager, *message.get_args())
     self.assertEqual(error, f'`NaN` isn\'t a valid dungeon level.')
Ejemplo n.º 8
0
 def test_valid_insertion_plus_level(self):
     user_input = '!add Moo Waycrest Manor +10'
     message = DiscordMessage(user_input)
     ctx = DiscordCtx(message)
     error = insert_keystone(ctx, self.db_manager, *message.get_args())
     self.assertEqual(error, 'Added Waycrest Manor +10 for Moo')
Ejemplo n.º 9
0
 def test_valid_character_name_all(self):
     user_input = '!add M_5-m wm 5'
     message = DiscordMessage(user_input)
     ctx = DiscordCtx(message)
     error = insert_keystone(ctx, self.db_manager, *message.get_args())
     self.assertEqual(error, f'Added Waycrest Manor +5 for M_5-m')