def test_add_speaker_spec(self):
    self.patch_object(self.c, 'write_configuration', name='mock_c_write_configuration')
    self.c.add_speaker_spec('udp', 1024, '1.2.3.4', send_size=50)
    self.assertIn(('udp', '1.2.3.4', 1024), self.c._speakers)
    self.assertEqual(self.c._speakers[('udp', '1.2.3.4', 1024)], {'name': 'base:send:udp:1.2.3.4:1024', 'ipv4': '1.2.3.4', 'port': 1024, 'protocol': 'udp', 'send-size': 50, 'wait': 5, 'interval': 10})
    self.mock_c_write_configuration.assert_called_once_with()
    self.mock_c_write_configuration.reset_mock()
    self.c.add_speaker_spec('http', 1024, '1.2.3.4', send_size=50)
    self.assertIn(('http', '1.2.3.4', 1024), self.c._speakers)
    self.assertEqual(self.c._speakers[('http', '1.2.3.4', 1024)], {'name': 'base:request:http:1.2.3.4:1024', 'url': 'http://1.2.3.4:1024/{uuid}', 'protocol': 'http', 'wait': 5, 'interval': 10})
    self.mock_c_write_configuration.assert_called_once_with()
    self.mock_c_write_configuration.reset_mock()
    with self.assertRaises(AssertionError):
        self.c.add_speaker_spec('thing', 1024, '1.2.3.4', send_size=50)
def test_add_speaker_spec(self):
    self.patch_object(self.c, 'write_configuration', name='mock_c_write_configuration')
    self.c.add_speaker_spec('udp', 1024, '1.2.3.4', send_size=50)
    self.assertIn(('udp', '1.2.3.4', 1024), self.c._speakers)
    self.assertEqual(self.c._speakers[('udp', '1.2.3.4', 1024)], {'name': 'base:send:udp:1.2.3.4:1024', 'ipv4': '1.2.3.4', 'port': 1024, 'protocol': 'udp', 'send-size': 50, 'wait': 5, 'interval': 10})
    self.mock_c_write_configuration.assert_called_once_with()
    self.mock_c_write_configuration.reset_mock()
    self.c.add_speaker_spec('http', 1024, '1.2.3.4', send_size=50)
    self.assertIn(('http', '1.2.3.4', 1024), self.c._speakers)
    self.assertEqual(self.c._speakers[('http', '1.2.3.4', 1024)], {'name': 'base:request:http:1.2.3.4:1024', 'url': 'http://1.2.3.4:1024/{uuid}', 'protocol': 'http', 'wait': 5, 'interval': 10})
    self.mock_c_write_configuration.assert_called_once_with()
    self.mock_c_write_configuration.reset_mock()
    with self.assertRaises(AssertionError):
        self.c.add_speaker_spec('thing', 1024, '1.2.3.4', send_size=50)