test_push_message.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import unittest
  2. from core.NeuronModule import MissingParameterException
  3. from neurons.push_message.push_message import Push_message
  4. class TestPush_Message(unittest.TestCase):
  5. def setUp(self):
  6. self.message="message"
  7. self.api_key="api_key"
  8. self.channel_name = "channel_name"
  9. def testParameters(self):
  10. def run_test(parameters_to_test):
  11. with self.assertRaises(MissingParameterException):
  12. Push_message(**parameters_to_test)
  13. # empty
  14. parameters = dict()
  15. run_test(parameters)
  16. # missing api_key
  17. parameters = {
  18. "message": self.message,
  19. "channel_name": self.channel_name
  20. }
  21. run_test(parameters)
  22. # missing channel_name
  23. parameters = {
  24. "api_key": self.api_key,
  25. "message":self.message
  26. }
  27. run_test(parameters)
  28. # missing message
  29. parameters = {
  30. "api_key": self.api_key,
  31. "channel_name": self.channel_name
  32. }
  33. run_test(parameters)
  34. if __name__ == '__main__':
  35. unittest.main()