File: spec_tests.py

package info (click to toggle)
python-pika 1.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,064 kB
  • sloc: python: 20,886; makefile: 136
file content (34 lines) | stat: -rw-r--r-- 854 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- coding: utf8 -*-
"""
Tests for pika.spec

"""
import unittest

from pika import spec
from pika.compat import long


class BasicPropertiesTests(unittest.TestCase):
    def test_equality(self):
        a = spec.BasicProperties(content_type='text/plain')
        self.assertEqual(a, a)
        self.assertNotEqual(a, None)

        b = spec.BasicProperties()
        self.assertNotEqual(a, b)
        b.content_type = 'text/plain'
        self.assertEqual(a, b)

        a.correlation_id = 'abc123'
        self.assertNotEqual(a, b)

        b.correlation_id = 'abc123'
        self.assertEqual(a, b)

    def test_headers_repr(self):
        hdr = 'timestamp_in_ms'
        v = long(912598613)
        h = { hdr : v }
        p = spec.BasicProperties(content_type='text/plain', headers=h)
        self.assertEqual(repr(p.headers[hdr]), '912598613L')