test_deactivation.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from yandex_music import Deactivation
  2. class TestDeactivation:
  3. method = 'ussd'
  4. instructions = 'Отключение услуги: *301# (недоступно в роуминге)'
  5. def test_expected_values(self, deactivation):
  6. assert deactivation.method == self.method
  7. assert deactivation.instructions == self.instructions
  8. def test_de_json_none(self, client):
  9. assert Deactivation.de_json({}, client) is None
  10. def test_de_list_none(self, client):
  11. assert Deactivation.de_list([], client) == []
  12. def test_de_json_required(self, client):
  13. json_dict = {'method': self.method}
  14. deactivation = Deactivation.de_json(json_dict, client)
  15. assert deactivation.method == self.method
  16. def test_de_json_all(self, client):
  17. json_dict = {'method': self.method, 'instructions': self.instructions}
  18. deactivation = Deactivation.de_json(json_dict, client)
  19. assert deactivation.method == self.method
  20. assert deactivation.instructions == self.instructions
  21. def test_equality(self):
  22. a = Deactivation(self.method, self.instructions)
  23. b = Deactivation('', self.instructions)
  24. c = Deactivation(self.method, self.instructions)
  25. assert a != b
  26. assert hash(a) != hash(b)
  27. assert a is not b
  28. assert a == c