예제 #1
0
 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'
     })
예제 #2
0
 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'
     })
예제 #3
0
 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')),
     ]
예제 #4
0
 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')),
     ]
예제 #5
0
 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',
     }
예제 #6
0
 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',
     }
예제 #7
0
 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()
예제 #8
0
 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()
예제 #9
0
    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',
        }
예제 #10
0
    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',
        }
예제 #11
0
 def test_send_nobody(self):
     s = tinystomp.send('/foo/bar', a='b')
     self.assertParse(s, 'SEND', '', {
         'a': 'b',
         'destination': '/foo/bar'
     })
예제 #12
0
 def test_send_nobody(self):
     s = tinystomp.send('/foo/bar', a='b')
     self.assertParse(s, 'SEND', '', {'a': 'b', 'destination': '/foo/bar'})