def test_send_body(self): s = tinystomp.send('/foo/bar', 'dave', a='b') self.assertParse(s, 'SEND', 'dave', { 'a': 'b', 'content-length': '4', 'destination': '/foo/bar' })
def test_getattr_present(self, sock): c = tinystomp.Client.from_url('tcp://host:1234/') c.connect() c.send('/foo/bar/', 'a', a='b') assert sock.mock_calls == [ mock.call(), mock.call().connect(('host', 1234)), mock.call().send(tinystomp.connect('host')), mock.call().send(tinystomp.send('/foo/bar/', 'a', a='b')), ]
def test_one_body(self): p = tinystomp.Parser() p.receive(tinystomp.send('/foo/bar', 'dave', a='b')) assert p.can_read() f = p.next() assert f.command == 'SEND' assert f.body == 'dave' assert f.headers == { 'a': 'b', 'content-length': '4', 'destination': '/foo/bar', }
def test_one_ignore_eol(self): p = tinystomp.Parser() eols = '\n\r\n\n' p.receive(eols + tinystomp.send('/foo/bar', 'dave', a='b') + eols) assert p.can_read() f = p.next() assert f.command == 'SEND' assert f.body == 'dave' assert f.headers == { 'a': 'b', 'content-length': '4', 'destination': '/foo/bar', } assert not p.can_read()
def test_one_partial_inheader(self): p = tinystomp.Parser() eols = '\n\r\n\n' s = eols + tinystomp.send('/foo/bar', 'dave', a='b') + eols p.receive(s[:12]) assert not p.can_read() p.receive(s[12:]) assert p.can_read() f = p.next() assert f.command == 'SEND' assert f.body == 'dave' assert f.headers == { 'a': 'b', 'content-length': '4', 'destination': '/foo/bar', }
def test_send_nobody(self): s = tinystomp.send('/foo/bar', a='b') self.assertParse(s, 'SEND', '', { 'a': 'b', 'destination': '/foo/bar' })
def test_send_nobody(self): s = tinystomp.send('/foo/bar', a='b') self.assertParse(s, 'SEND', '', {'a': 'b', 'destination': '/foo/bar'})