import py
import autopath
from httpmp2.client import Client
from httpmp2.command import Command

class config:
    max_events_per_request = 20
    max_events_in_buffer = 10

class FakeOutChannel(object):
    def __init__(self):
        self.commands = []

    def push_with_producer(self, command):
        self.commands.append(command)

class TestClient(object):
    def test_push_command(self):
        oc = FakeOutChannel()
        c = Client(config, 1, oc)
        c.push_command(Command('foo', 'bar'))
        assert len(oc.commands) == 1
        assert oc.commands[0].type == 'foo'
        assert oc.commands[0].value == 'bar'
        

