Passed
Pull Request — main (#226)
by
unknown
01:32
created

test_guild   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 132
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 108
dl 0
loc 132
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B TestChannel.test_get() 0 61 1
1
# Copyright Pincer 2021-Present
2
# Full MIT License can be found in `LICENSE` at the project root.
3
4
from pincer.objects import Guild, Emoji, Channel, Role
5
6
FAKE_GUILD = {
7
    'id': '0',
8
    'name': 'test-server',
9
    'features': [],
10
    'emojis': [
11
        {'name': 'test-emoji',
12
         'roles': [],
13
         'id': '0',
14
         'require_colons': True,
15
         'managed': False,
16
         'animated': False,
17
         'available': True
18
         }
19
    ],
20
    'stickers': [],
21
    'owner_id': '0',
22
    'region': 'us-east',
23
    'afk_timeout': 300,
24
    'system_channel_id': '0',
25
    'widget_enabled': False,
26
    'widget_channel_id': '0',
27
    'verification_level': 0,
28
    'roles': [
29
        {'id': '0',
30
         'name': '@everyone',
31
         'permissions': '0',
32
         'position': 0,
33
         'color': 0,
34
         'hoist': False,
35
         'managed': False,
36
         'mentionable': False,
37
         }
38
    ],
39
    'default_message_notifications': 0,
40
    'mfa_level': 0,
41
    'explicit_content_filter': 0,
42
    'max_members': 250000,
43
    'max_video_channel_users': 25,
44
    'premium_tier': 0,
45
    'premium_subscription_count': 0,
46
    'system_channel_flags': 0,
47
    'preferred_locale': 'en-US',
48
    'premium_progress_bar_enabled': False,
49
    'nsfw': False,
50
    'nsfw_level': 0,
51
    'channels':
52
    # This is not how channels are passed into Guild.from_dict in the code. A
53
    # Channel object is passed in instead. I haven't done that here because the
54
    # Guild.from_dict() method expects a Dict without APIObjects in it.
55
    # The code should be changed to reflect that once this test is made passing.
56
    [
57
        {'id': '0',
58
         'type': 4,
59
         'name': 'Text Channels',
60
         'position': 0,
61
         'guild_id': '0',
62
         'permission_overwrites': [],
63
         'nsfw': False
64
         },
65
    ]
66
}
67
68
69
class TestChannel:
70
71
    @staticmethod
72
    def test_get():
73
74
        guild = Guild.from_dict(FAKE_GUILD)
75
76
        assert guild == Guild(
77
            id=0,
78
            name="test-server",
79
            features=[],
80
            emojis=[
81
                Emoji(
82
                    name="test-emoji",
83
                    roles=[],
84
                    id=0,
85
                    require_colons=True,
86
                    managed=False,
87
                    animated=False,
88
                    available=True
89
                )
90
            ],
91
            stickers=[],
92
            owner_id=0,
93
            region="us-east",
94
            afk_timeout=300,
95
            system_channel_id=0,
96
            widget_enabled=False,
97
            widget_channel_id=0,
98
            verification_level=0,
99
            roles=[
100
                Role(
101
                    id=0,
102
                    name="@everyone",
103
                    permissions=0,
104
                    position=0,
105
                    color=0,
106
                    hoist=False,
107
                    managed=False,
108
                    mentionable=False,
109
                )
110
            ],
111
            default_message_notifications=0,
112
            mfa_level=0,
113
            explicit_content_filter=0,
114
            max_members=250000,
115
            max_video_channel_users=25,
116
            premium_tier=0,
117
            premium_subscription_count=0,
118
            system_channel_flags=0,
119
            preferred_locale="en-US",
120
            premium_progress_bar_enabled=False,
121
            nsfw=False,
122
            nsfw_level=0,
123
            channels=[
124
                Channel(
125
                    id=0,
126
                    type=4,
127
                    name="Text Channels",
128
                    position=0,
129
                    guild_id=0,
130
                    permission_overwrites=[],
131
                    nsfw=False
132
                )
133
            ]
134
        )
135