~ubuntu-branches/ubuntu/utopic/oslo.messaging/utopic

« back to all changes in this revision

Viewing changes to tests/test_notifier.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-12-04 10:58:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20131204105843-9xy23au9h6deh8rr
Tags: 1.2.0~a11-0ubuntu1
* New upstream release:
  - debian/watch: Fix typo (LP: #1212684)

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
        ('not_v2', dict(v2=False)),
83
83
    ]
84
84
 
 
85
    _publisher_id = [
 
86
        ('ctor_pub_id', dict(ctor_pub_id='test',
 
87
                             expected_pub_id='test')),
 
88
        ('prep_pub_id', dict(prep_pub_id='test.localhost',
 
89
                             expected_pub_id='test.localhost')),
 
90
        ('override', dict(ctor_pub_id='test',
 
91
                          prep_pub_id='test.localhost',
 
92
                          expected_pub_id='test.localhost')),
 
93
    ]
 
94
 
85
95
    _topics = [
86
96
        ('no_topics', dict(topics=[])),
87
97
        ('single_topic', dict(topics=['notifications'])),
108
118
    def generate_scenarios(cls):
109
119
        cls.scenarios = testscenarios.multiply_scenarios(cls._v1,
110
120
                                                         cls._v2,
 
121
                                                         cls._publisher_id,
111
122
                                                         cls._topics,
112
123
                                                         cls._priority,
113
124
                                                         cls._payload,
136
147
 
137
148
        transport = _FakeTransport(self.conf)
138
149
 
139
 
        notifier = messaging.Notifier(transport, 'test.localhost')
 
150
        if hasattr(self, 'ctor_pub_id'):
 
151
            notifier = messaging.Notifier(transport,
 
152
                                          publisher_id=self.ctor_pub_id)
 
153
        else:
 
154
            notifier = messaging.Notifier(transport)
 
155
 
 
156
        if hasattr(self, 'prep_pub_id'):
 
157
            notifier = notifier.prepare(publisher_id=self.prep_pub_id)
140
158
 
141
159
        self.mox.StubOutWithMock(transport, '_send_notification')
142
160
 
148
166
 
149
167
        message = {
150
168
            'message_id': str(message_id),
151
 
            'publisher_id': 'test.localhost',
 
169
            'publisher_id': self.expected_pub_id,
152
170
            'event_type': 'test.notify',
153
171
            'priority': self.priority.upper(),
154
172
            'payload': self.payload,