|
36 | 36 | except ImportError: |
37 | 37 | rhmsg = None |
38 | 38 |
|
39 | | -try: |
40 | | - import fedora_messaging |
41 | | -except ImportError: |
42 | | - fedora_messaging = None |
43 | | - |
44 | 39 |
|
45 | 40 | @unittest.skipUnless(rhmsg, "rhmsg is required to run this test case.") |
46 | 41 | class TestRHMsgSendMessageWhenComposeIsCreated(ModelsBaseTest): |
@@ -86,43 +81,6 @@ def test_send_message(self, Message, AMQProducer): |
86 | 81 | producer_send.assert_called_once_with(Message.return_value) |
87 | 82 |
|
88 | 83 |
|
89 | | -@unittest.skipUnless( |
90 | | - fedora_messaging, "fedora_messaging is required to run this test case." |
91 | | -) |
92 | | -class TestFedoraMessagingSendMessageWhenComposeIsCreated(ModelsBaseTest): |
93 | | - """Test send message when compose is created""" |
94 | | - |
95 | | - disable_event_handlers = False |
96 | | - |
97 | | - def setUp(self): |
98 | | - super(TestFedoraMessagingSendMessageWhenComposeIsCreated, self).setUp() |
99 | | - |
100 | | - # Real lock is not required for running tests |
101 | | - self.mock_lock = patch("threading.Lock") |
102 | | - self.mock_lock.start() |
103 | | - |
104 | | - def tearDown(self): |
105 | | - super(TestFedoraMessagingSendMessageWhenComposeIsCreated, self).tearDown() |
106 | | - self.mock_lock.stop() |
107 | | - |
108 | | - def setup_composes(self): |
109 | | - User.create_user(username="odcs") |
110 | | - self.compose = Compose.create(db.session, "odcs", self.ci)[0] |
111 | | - |
112 | | - @patch.object(conf, "messaging_backend", new="fedora-messaging") |
113 | | - @patch("fedora_messaging.api.Message") |
114 | | - @patch("fedora_messaging.api.publish") |
115 | | - def test_send_message(self, publish, Message): |
116 | | - compose = Compose.create(db.session, "odcs", self.ci)[0] |
117 | | - |
118 | | - Message.assert_called_once_with( |
119 | | - topic="cts.compose-created", |
120 | | - body={"event": "compose-created", "compose": compose.json()}, |
121 | | - ) |
122 | | - |
123 | | - publish.assert_called_once_with(Message.return_value) |
124 | | - |
125 | | - |
126 | 84 | @patch("cts.messaging.publish") |
127 | 85 | class TestMessaging(ModelsBaseTest): |
128 | 86 | """Test send message when compose is created""" |
|
0 commit comments