test_alert_button.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. from yandex_music import AlertButton
  2. class TestAlertButton:
  3. text = 'Оформить подписку'
  4. bg_color = '#FFFFFF'
  5. text_color = '#191919'
  6. uri = 'https://plus.yandex.ru/?source=music_web_churn_subscriptionend'
  7. def test_expected_values(self, alert_button):
  8. assert alert_button.text == self.text
  9. assert alert_button.bg_color == self.bg_color
  10. assert alert_button.text_color == self.text_color
  11. assert alert_button.uri == self.uri
  12. def test_de_json_none(self, client):
  13. assert AlertButton.de_json({}, client) is None
  14. def test_de_json_required(self, client):
  15. json_dict = {'text': self.text, 'bg_color': self.bg_color, 'text_color': self.text_color, 'uri': self.uri}
  16. alert_button = AlertButton.de_json(json_dict, client)
  17. assert alert_button.text == self.text
  18. assert alert_button.bg_color == self.bg_color
  19. assert alert_button.text_color == self.text_color
  20. assert alert_button.uri == self.uri
  21. def test_de_json_all(self, client):
  22. json_dict = {'text': self.text, 'bg_color': self.bg_color, 'text_color': self.text_color, 'uri': self.uri}
  23. alert_button = AlertButton.de_json(json_dict, client)
  24. assert alert_button.text == self.text
  25. assert alert_button.bg_color == self.bg_color
  26. assert alert_button.text_color == self.text_color
  27. assert alert_button.uri == self.uri
  28. def test_equality(self):
  29. a = AlertButton(self.text, self.bg_color, self.text_color, self.uri)
  30. b = AlertButton('', self.bg_color, self.text_color, '')
  31. c = AlertButton(self.text, self.bg_color, self.text_color, self.uri)
  32. assert a != b
  33. assert hash(a) != hash(b)
  34. assert a is not b
  35. assert a == c