1
1
# =============================================================================
2
2
# >> IMPORTS
3
3
# =============================================================================
4
+ # Python Imports
4
5
from unittest import TestCase , main
5
6
7
+ # Settings Imports
8
+ from steamwebapi .settings import STEAM_API_KEY , DEFAULT_LANGUAGE
9
+
10
+ # Core Imports
11
+ from steamwebapi .core import SteamWebAPI , APIQuery
12
+
13
+ # Util Imports
14
+ from steamwebapi .util .exceptions import APIKeyInvalidError
15
+
6
16
7
17
# =============================================================================
8
18
# >> TEST CLASSES
@@ -12,7 +22,6 @@ class TestCoreSteamWebAPI(TestCase):
12
22
13
23
def setUp (self ):
14
24
"""Initializes a SteamWebAPI instance."""
15
- from steamwebapi .core import SteamWebAPI
16
25
self .steamwebapi = SteamWebAPI ()
17
26
18
27
# -------------------------------------------------------------------------
@@ -23,7 +32,6 @@ def test_api_key_equalto_settings_api_key(self):
23
32
the STEAM_API_KEY from ./steamwebapi/settings.py.
24
33
25
34
"""
26
- from steamwebapi .settings import STEAM_API_KEY
27
35
self .assertEqual (
28
36
self .steamwebapi .key ,
29
37
STEAM_API_KEY ,
@@ -37,7 +45,6 @@ def test_api_key_not_equalto_settings_api_key(self):
37
45
STEAM_API_KEY from ./steamwebapi/settings.py.
38
46
39
47
"""
40
- from steamwebapi .settings import STEAM_API_KEY
41
48
self .steamwebapi .key = 'XXXX0000XXXX0000XXXX0000XXXX0000'
42
49
self .assertNotEqual (
43
50
self .steamwebapi .key ,
@@ -54,7 +61,6 @@ def test_api_key_initialized_from__init__with_keyword_arg(self):
54
61
argument.
55
62
56
63
"""
57
- from steamwebapi .core import SteamWebAPI
58
64
self .steamwebapi = SteamWebAPI (key = 'XXXX0000XXXX0000XXXX0000XXXX0000' )
59
65
self .assertEqual (
60
66
self .steamwebapi .key ,
@@ -69,7 +75,6 @@ def test_api_key_initialized_from__init__no_keyword_arg(self):
69
75
causing a regression for users that do not provide keyword arguments.
70
76
71
77
"""
72
- from steamwebapi .core import SteamWebAPI
73
78
# Set a fake (bad) Steam Web API Key
74
79
self .steamwebapi = SteamWebAPI ('XXXX0000XXXX0000XXXX0000XXXX0000' )
75
80
self .assertEqual (
@@ -85,8 +90,6 @@ def test_api_key_invalid_28_alphanumeric_characters(self):
85
90
will test by passing in 28 alphanumeric characters.
86
91
87
92
"""
88
- from steamwebapi .core import SteamWebAPI
89
- from steamwebapi .util .exceptions import APIKeyInvalidError
90
93
with self .assertRaises (APIKeyInvalidError ):
91
94
# Send a 28 instead of 32 character API key
92
95
self .steamwebapi = SteamWebAPI ('XXXX0000XXXX0000XXXX0000XXXX' )
@@ -97,8 +100,6 @@ def test_api_key_invalid_non_alphanumeric_character(self):
97
100
will test by passing in a non-alphanumeric character.
98
101
99
102
"""
100
- from steamwebapi .core import SteamWebAPI
101
- from steamwebapi .util .exceptions import APIKeyInvalidError
102
103
with self .assertRaises (APIKeyInvalidError ):
103
104
# Add a "." (non-alphanumeric character)
104
105
self .steamwebapi = SteamWebAPI ('XXXX0000XXXX0000XXXX.000XXXX0000' )
@@ -109,7 +110,6 @@ def test_api_key_empty(self):
109
110
the APIKeyInvalidError.
110
111
111
112
"""
112
- from steamwebapi .core import SteamWebAPI
113
113
self .steamwebapi = SteamWebAPI (key = '' )
114
114
self .assertEqual (
115
115
self .steamwebapi .key ,
@@ -126,7 +126,6 @@ def test_default_language_equalto_settings_default_language(self):
126
126
the DEFAULT_LANGUAGE from ./steamwebapi/settings.py.
127
127
128
128
"""
129
- from steamwebapi .settings import DEFAULT_LANGUAGE
130
129
self .assertEqual (
131
130
self .steamwebapi .language ,
132
131
DEFAULT_LANGUAGE ,
@@ -140,7 +139,6 @@ def test_default_language_not_equalto_settings_default_language(self):
140
139
DEFAULT_LANGUAGE from ./steamwebapi/settings.py.
141
140
142
141
"""
143
- from steamwebapi .settings import DEFAULT_LANGUAGE
144
142
self .steamwebapi .language = 'not_a_real_language'
145
143
self .assertNotEqual (
146
144
self .steamwebapi .language ,
@@ -157,7 +155,6 @@ def test_default_language_initialized_from__init__with_keyword_arg(self):
157
155
name of the argument.
158
156
159
157
"""
160
- from steamwebapi .core import SteamWebAPI
161
158
# Set a fake (bad) Steam Web API Key
162
159
self .steamwebapi = SteamWebAPI (language = 'not_a_real_language' )
163
160
self .assertEqual (
@@ -174,7 +171,6 @@ def test_default_language_initialized_from__init__no_keyword_arg(self):
174
171
keyword arguments.
175
172
176
173
"""
177
- from steamwebapi .core import SteamWebAPI
178
174
# Set a fake (bad) Steam Web API Key
179
175
self .steamwebapi = SteamWebAPI (
180
176
'XXXX0000XXXX0000XXXX0000XXXX0000' ,
@@ -197,7 +193,6 @@ class TestAPIQuery(TestCase):
197
193
198
194
def setUp (self ):
199
195
"""Initializes an APIQuery instance."""
200
- from steamwebapi .core import APIQuery
201
196
self .apiquery = APIQuery (
202
197
interface = 'ISteamWebAPIUtil' ,
203
198
method = 'GetSupportedAPIList' ,
0 commit comments