Пример #1
0
 def test_addCommandToSqlStore_whenAddingCommand_shouldBeInStore(
         self) -> None:
     command_store = SqlCommandStore(':memory:')
     self.assertEqual(0, command_store.get_num_commands())
     command_str = "some command string"
     directory_path = 'directory/path'
     command = Command(command_str, directory_context=directory_path)
     command_store.add_command(command)
     self.assertTrue(command_store.has_command(command))
     self.assertFalse(
         command_store.has_command(Command("some other command")))
     self.assertEqual(1, command_store.get_num_commands())
Пример #2
0
 def test_addCommand_whenSameCommandAndContext_shouldReturnAppropriateCount(
         self) -> None:
     store = SqlCommandStore(':memory:')
     self.assertEqual(0, store.get_num_commands())
     command_str = "some command string"
     directory_path = 'directory/path'
     command = Command(command_str, directory_context=directory_path)
     store.add_command(command)
     store.add_command(command)
     store.add_command(command)
     store.add_command(command)
     self.assertTrue(store.has_command(command))
     self.assertEqual(1, store.get_num_commands())
     commands = store.get_command_with_context(directory_path, [])
     self.assertEqual(1, len(commands))
     result_command = commands[0]
     self.assertEqual(4, result_command.get_count_seen())