Example #1
0
    def test_configure(self):
        command = CommandBuilder.configure("acct:[email protected]", 2)

        assert isinstance(command, ConfigCommand)
        assert isinstance(command.body, Configuration)
        assert command.body.effective_user == "acct:[email protected]"
        assert command.body.total_instructions == 2
Example #2
0
    def test_all_items_are_flushed_to_executor(self, command_processor,
                                               executor, user_command,
                                               group_command):
        config = CommandBuilder.configure(
            effective_user="******", total_instructions=5)

        command_processor.process(
            [config, user_command, user_command, group_command, group_command])

        executor.execute_batch.assert_has_calls([
            call(
                batch=[user_command, user_command],
                command_type=CommandType.UPSERT,
                data_type=DataType.USER,
                default_config=Any.dict(),
            ),
            call(
                batch=[group_command, group_command],
                command_type=CommandType.UPSERT,
                data_type=DataType.GROUP,
                default_config=Any.dict(),
            ),
        ])
Example #3
0
File: conftest.py Project: banek/h
def config_command():
    return CommandBuilder.configure(
        effective_user="******", total_instructions=2
    )