180
180
for a in ('wordpad', 'wordpad.exe'):
181
181
p = get_app_path(a)
182
182
d, b = os.path.split(p)
183
self.assertEqual('wordpad.exe', b.lower())
184
self.assertNotEqual('', d)
183
self.assertEquals('wordpad.exe', b.lower())
184
self.assertNotEquals('', d)
186
186
def test_not_existing(self):
187
187
p = get_app_path('not-existing')
188
self.assertEqual('not-existing', p)
188
self.assertEquals('not-existing', p)
191
class TestLocations(TestCase):
192
"""Tests for windows specific path and name retrieving functions"""
194
def test__ensure_unicode_deprecated(self):
196
u1 = self.applyDeprecated(symbol_versioning.deprecated_in((2, 5, 0)),
197
win32utils._ensure_unicode, s)
198
self.assertEqual(s, u1)
199
self.assertIsInstance(u1, unicode)
200
u2 = self.applyDeprecated(symbol_versioning.deprecated_in((2, 5, 0)),
201
win32utils._ensure_unicode, u1)
202
self.assertIs(u1, u2)
204
def test_appdata_unicode_deprecated(self):
205
self.overrideEnv("APPDATA", "fakepath")
206
s = win32utils.get_appdata_location()
207
u = self.applyDeprecated(symbol_versioning.deprecated_in((2, 5, 0)),
208
win32utils.get_appdata_location_unicode)
209
self.assertEqual(s, u)
210
self.assertIsInstance(s, unicode)
212
def test_home_unicode_deprecated(self):
213
s = win32utils.get_home_location()
214
u = self.applyDeprecated(symbol_versioning.deprecated_in((2, 5, 0)),
215
win32utils.get_home_location_unicode)
216
self.assertEqual(s, u)
217
self.assertIsInstance(s, unicode)
219
def test_user_unicode_deprecated(self):
220
self.overrideEnv("USERNAME", "alien")
221
s = win32utils.get_user_name()
222
u = self.applyDeprecated(symbol_versioning.deprecated_in((2, 5, 0)),
223
win32utils.get_user_name_unicode)
224
self.assertEqual(s, u)
225
self.assertIsInstance(s, unicode)
227
def test_host_unicode_deprecated(self):
228
self.overrideEnv("COMPUTERNAME", "alienbox")
229
s = win32utils.get_host_name()
230
u = self.applyDeprecated(symbol_versioning.deprecated_in((2, 5, 0)),
231
win32utils.get_host_name_unicode)
232
self.assertEqual(s, u)
233
self.assertIsInstance(s, unicode)
191
236
class TestLocationsCtypes(TestCase):
193
_test_needs_features = [CtypesFeature, features.win32_feature]
238
_test_needs_features = [CtypesFeature]
195
240
def assertPathsEqual(self, p1, p2):
196
241
# TODO: The env var values in particular might return the "short"
197
242
# version (ie, "C:\DOCUME~1\..."). Its even possible the returned
198
243
# values will differ only by case - handle these situations as we
199
244
# come across them.
200
self.assertEqual(p1, p2)
245
self.assertEquals(p1, p2)
202
247
def test_appdata_not_using_environment(self):
203
248
# Test that we aren't falling back to the environment