def test_equality(self, product): a = Settings([product], [product], self.web_payment_url, self.promo_codes_enabled) b = Settings([product], [product], '', self.promo_codes_enabled) c = Settings([product], [product], self.web_payment_url, False) d = Settings([product], [product], self.web_payment_url, self.promo_codes_enabled) assert a != b != c assert hash(a) != hash(b) != hash(c) assert a is not b is not c assert a == d
def test_de_json_required(self, client, product): json_dict = { 'in_app_products': [product.to_dict()], 'native_products': [product.to_dict()], 'web_payment_url': self.web_payment_url, 'promo_codes_enabled': self.promo_codes_enabled } settings = Settings.de_json(json_dict, client) assert settings.in_app_products == [product] assert settings.native_products == [product] assert settings.web_payment_url == self.web_payment_url assert settings.promo_codes_enabled == self.promo_codes_enabled
def test_de_json_all(self, client, product, price): json_dict = { 'in_app_products': [product.to_dict()], 'native_products': [product.to_dict()], 'web_payment_url': self.web_payment_url, 'promo_codes_enabled': self.promo_codes_enabled, 'web_payment_month_product_price': price.to_dict() } settings = Settings.de_json(json_dict, client) assert settings.in_app_products == [product] assert settings.native_products == [product] assert settings.web_payment_url == self.web_payment_url assert settings.promo_codes_enabled == self.promo_codes_enabled assert settings.web_payment_month_product_price == price
def settings(self, timeout=None, *args, **kwargs): """Получение предложений по покупке. Нет обязательных параметров. Args: timeout (:obj:`int` | :obj:`float`, optional): Если это значение указано, используется как время ожидания ответа от сервера вместо указанного при создании пула. **kwargs (:obj:`dict`, optional): Произвольные аргументы (будут переданы в запрос). Returns: :obj:`yandex_music.Settings`: Объекта класса :class:`yandex_music.Settings` предоставляющий информацию о предлагаемых продуктах, иначе :obj:`None`. Raises: :class:`yandex_music.YandexMusicError` """ url = f'{self.base_url}/settings' result = self._request.get(url, timeout=timeout, *args, **kwargs) return Settings.de_json(result, self)
def settings(product, price): return Settings([product], [product], TestSettings.web_payment_url, TestSettings.promo_codes_enabled, price)
def test_de_json_none(self, client): assert Settings.de_json({}, client) is None