2019-11-08 02:09:39 +09:00
|
|
|
from yandex_music import Subscription
|
|
|
|
|
|
|
|
|
|
|
|
class TestSubscription:
|
Добавлены основные тесты для следующий классов: Account, CaseForms, Cover, DownloadInfo, Enum, InvocationInfo, Lyrics, MadeFor, Permissions, PersonalPlaylistsData, PlayContextsData, Promotion, RotorSettings, Subsription,
Исправлены фикстуры и сравнения для вышеперечисленных классов.
Починен conftest.py
2019-11-08 09:30:15 +09:00
|
|
|
can_start_trial = False
|
|
|
|
mcdonalds = False
|
2019-11-08 02:09:39 +09:00
|
|
|
end = None
|
|
|
|
|
2020-06-14 21:09:50 +09:00
|
|
|
def test_expected_values(self, subscription, renewable_remainder, auto_renewable, non_auto_renewable, operator):
|
2020-04-17 03:35:45 +09:00
|
|
|
assert subscription.non_auto_renewable_remainder == renewable_remainder
|
Добавлены основные тесты для следующий классов: Account, CaseForms, Cover, DownloadInfo, Enum, InvocationInfo, Lyrics, MadeFor, Permissions, PersonalPlaylistsData, PlayContextsData, Promotion, RotorSettings, Subsription,
Исправлены фикстуры и сравнения для вышеперечисленных классов.
Починен conftest.py
2019-11-08 09:30:15 +09:00
|
|
|
assert subscription.auto_renewable == [auto_renewable]
|
2020-06-07 20:46:37 +09:00
|
|
|
assert subscription.family_auto_renewable == [auto_renewable]
|
2020-06-14 21:09:50 +09:00
|
|
|
assert subscription.operator == [operator]
|
|
|
|
assert subscription.non_auto_renewable == non_auto_renewable
|
2019-11-08 02:09:39 +09:00
|
|
|
assert subscription.can_start_trial == self.can_start_trial
|
|
|
|
assert subscription.mcdonalds == self.mcdonalds
|
|
|
|
assert subscription.end == self.end
|
|
|
|
|
2019-12-29 16:38:24 +09:00
|
|
|
def test_de_json_none(self, client):
|
|
|
|
assert Subscription.de_json({}, client) is None
|
|
|
|
|
2020-04-17 03:35:45 +09:00
|
|
|
def test_de_json_required(self, client, renewable_remainder, auto_renewable):
|
2021-02-03 21:28:10 +09:00
|
|
|
json_dict = {
|
|
|
|
'non_auto_renewable_remainder': renewable_remainder.to_dict(),
|
|
|
|
'auto_renewable': [auto_renewable.to_dict()],
|
|
|
|
'family_auto_renewable': [auto_renewable.to_dict()],
|
|
|
|
}
|
2019-11-08 02:09:39 +09:00
|
|
|
subscription = Subscription.de_json(json_dict, client)
|
|
|
|
|
2020-04-17 03:35:45 +09:00
|
|
|
assert subscription.non_auto_renewable_remainder == renewable_remainder
|
|
|
|
assert subscription.auto_renewable == [auto_renewable]
|
2020-06-07 20:46:37 +09:00
|
|
|
assert subscription.family_auto_renewable == [auto_renewable]
|
2020-04-17 03:35:45 +09:00
|
|
|
|
2020-06-14 21:09:50 +09:00
|
|
|
def test_de_json_all(self, client, renewable_remainder, auto_renewable, non_auto_renewable, operator):
|
2021-02-03 21:28:10 +09:00
|
|
|
json_dict = {
|
|
|
|
'auto_renewable': [auto_renewable.to_dict()],
|
|
|
|
'can_start_trial': self.can_start_trial,
|
|
|
|
'mcdonalds': self.mcdonalds,
|
|
|
|
'end': self.end,
|
|
|
|
'non_auto_renewable_remainder': renewable_remainder.to_dict(),
|
|
|
|
'family_auto_renewable': [auto_renewable.to_dict()],
|
|
|
|
'non_auto_renewable': non_auto_renewable.to_dict(),
|
|
|
|
'operator': [operator.to_dict()],
|
|
|
|
}
|
2019-11-08 02:09:39 +09:00
|
|
|
subscription = Subscription.de_json(json_dict, client)
|
|
|
|
|
2020-04-17 03:35:45 +09:00
|
|
|
assert subscription.non_auto_renewable_remainder == renewable_remainder
|
Добавлены основные тесты для следующий классов: Account, CaseForms, Cover, DownloadInfo, Enum, InvocationInfo, Lyrics, MadeFor, Permissions, PersonalPlaylistsData, PlayContextsData, Promotion, RotorSettings, Subsription,
Исправлены фикстуры и сравнения для вышеперечисленных классов.
Починен conftest.py
2019-11-08 09:30:15 +09:00
|
|
|
assert subscription.auto_renewable == [auto_renewable]
|
2020-06-07 20:46:37 +09:00
|
|
|
assert subscription.family_auto_renewable == [auto_renewable]
|
2020-06-14 21:09:50 +09:00
|
|
|
assert subscription.operator == [operator]
|
|
|
|
assert subscription.non_auto_renewable == non_auto_renewable
|
2019-11-08 02:09:39 +09:00
|
|
|
assert subscription.can_start_trial == self.can_start_trial
|
|
|
|
assert subscription.mcdonalds == self.mcdonalds
|
|
|
|
assert subscription.end == self.end
|
|
|
|
|
2020-04-17 03:35:45 +09:00
|
|
|
def test_equality(self, renewable_remainder, auto_renewable):
|
2020-06-07 20:46:37 +09:00
|
|
|
a = Subscription(renewable_remainder, [auto_renewable], [auto_renewable])
|
|
|
|
b = Subscription(renewable_remainder, [], [auto_renewable])
|
Добавлены основные тесты для следующий классов: Account, CaseForms, Cover, DownloadInfo, Enum, InvocationInfo, Lyrics, MadeFor, Permissions, PersonalPlaylistsData, PlayContextsData, Promotion, RotorSettings, Subsription,
Исправлены фикстуры и сравнения для вышеперечисленных классов.
Починен conftest.py
2019-11-08 09:30:15 +09:00
|
|
|
|
2019-11-10 03:11:43 +09:00
|
|
|
assert a != b != auto_renewable
|
|
|
|
assert hash(a) != hash(b) != hash(auto_renewable)
|
Добавлены основные тесты для следующий классов: Account, CaseForms, Cover, DownloadInfo, Enum, InvocationInfo, Lyrics, MadeFor, Permissions, PersonalPlaylistsData, PlayContextsData, Promotion, RotorSettings, Subsription,
Исправлены фикстуры и сравнения для вышеперечисленных классов.
Починен conftest.py
2019-11-08 09:30:15 +09:00
|
|
|
assert a is not auto_renewable
|