-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtest_pyderman.py
646 lines (550 loc) · 23.4 KB
/
test_pyderman.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
from __future__ import annotations
import os
import platform
import re
import subprocess
import time
import unittest
from types import ModuleType
try:
# Python 3
from urllib.request import urlopen
except ImportError:
# Python 2
# noinspection PyUnresolvedReferences
from urllib2 import urlopen # type: ignore[import,no-redef]
from pyderman import chrome, edge, firefox, install, opera, phantomjs
def process_driver(driver: ModuleType, self: TestDriverInstalls) -> None:
print("Testing %s..." % driver.__name__)
try:
data = install(
browser=driver, verbose=True, chmod=True, overwrite=True, return_info=True
)
except OSError as err:
print(err)
return # OSError is raised if the given OS cannot support the driver, which we need to ignore.
if type(data) is not dict or not os.path.exists(str(data.get("path"))):
raise FileNotFoundError(
"The %s executable was not properly downloaded." % driver.__name__
)
path = str(data.get("path"))
output = subprocess.check_output([path, "--version"]).decode("utf-8")
print("Version:", output)
self.assertIn(
data["version"],
output.lower(),
msg="Driver %s did not output proper version! ('%s')"
% (driver.__name__, data["version"]),
)
print('{} is installed at: "{}"'.format(data["driver"], path))
print("\n\n\n")
class TestDriverInstalls(unittest.TestCase):
def test_details(self) -> None:
print("Machine:", platform.machine())
print("Platform:", platform.platform())
print("Arch:", platform.architecture())
print("Processor:", platform.processor())
print("Release:", platform.release())
def test_chrome(self) -> None:
process_driver(chrome, self)
def test_firefox(self) -> None:
process_driver(firefox, self)
def test_opera(self) -> None:
process_driver(opera, self)
def test_phantomjs(self) -> None:
process_driver(phantomjs, self)
def test_edge(self) -> None:
process_driver(edge, self)
class TestChrome(unittest.TestCase):
latest = None
@classmethod
def setUpClass(self) -> None:
version_re = re.compile(r"^(\d+)\.(\d+)\.(\d+)\.(\d+)$")
url = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE"
resp = urlopen(url, timeout=15)
html = resp.read().decode("utf-8", errors="ignore")
version_string = str(html)
self.latest = version_string
match = version_re.match(version_string)
if not match:
raise ValueError("Invalid version string: %r" % version_string)
major, minor, patch, build = match.groups()
self.major = major
self.minor = minor
self.patch = patch
self.build = build
return
def chrome_version(self, version: str) -> None:
drvr, url, vers = chrome.get_url(version, _os="mac", _os_bit="64")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://chromedriver.storage.googleapis.com/{self.latest}/chromedriver_mac64.zip",
)
def test_get_url_mac_arm(self):
drvr, url, vers = chrome.get_url(self.latest, _os="mac-arm", _os_bit="64")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://chromedriver.storage.googleapis.com/{self.latest}/chromedriver_mac_arm64.zip",
)
def test_get_url_mac_m1(self):
version = "105.0.5195.52"
drvr, url, vers = chrome.get_url(version, _os="mac-arm", _os_bit="64")
self.assertEqual(vers, version)
self.assertEqual(
url,
f"https://chromedriver.storage.googleapis.com/{version}/chromedriver_mac64_m1.zip",
)
def test_get_url_mac_86(self):
drvr, url, vers = chrome.get_url(self.latest, _os="mac", _os_bit="64")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://chromedriver.storage.googleapis.com/{self.latest}/chromedriver_mac64.zip",
)
def test_get_url_win_32(self):
drvr, url, vers = chrome.get_url(self.latest, _os="win", _os_bit="32")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://chromedriver.storage.googleapis.com/{self.latest}/chromedriver_win32.zip",
)
def test_get_url_win_64(self):
drvr, url, vers = chrome.get_url(self.latest, _os="win", _os_bit="64")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://chromedriver.storage.googleapis.com/{self.latest}/chromedriver_win64.zip",
)
def test_get_url_linux_64(self):
drvr, url, vers = chrome.get_url(self.latest, _os="linux", _os_bit="64")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://chromedriver.storage.googleapis.com/{self.latest}/chromedriver_linux64.zip",
)
def test_get_url_linux_32(self):
drvr, url, vers = chrome.get_url(self.latest, _os="linux", _os_bit="32")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://chromedriver.storage.googleapis.com/{self.latest}/chromedriver_linux32.zip",
)
def test_get_url_unrecognized_version(self):
version = "abd.xyz"
drvr, url, vers = chrome.get_url(version, _os="linux", _os_bit="32")
self.assertEqual(vers, version)
self.assertEqual(
url,
f"https://chromedriver.storage.googleapis.com/{version}/chromedriver_linux32.zip",
)
def test_get_latest(self) -> None:
self.chrome_version("latest")
def test_get_major(self) -> None:
self.chrome_version(f"{self.major}")
def test_get_patch(self) -> None:
self.chrome_version(f"{self.major}.{self.minor}.{self.patch}")
def test_get_build(self) -> None:
self.chrome_version(f"{self.latest}")
def test_get_nonsense(self) -> None:
with self.assertRaises(Exception) as exc:
self.chrome_version("25.25.25.25")
self.assertEqual(
str(exc.exception), "Unable to locate ChromeDriver version! [25.25.25.25]"
)
return
class TestEdge(unittest.TestCase):
version_re = re.compile(r"^(\d+)\.(\d+)\.(\d+)\.(\d+)$")
stable = None
major = None
@staticmethod
def fetch(url: str) -> str:
resp = urlopen(url, timeout=15)
html = resp.read().decode("utf-16", errors="ignore").strip()
return str(html)
@staticmethod
def looseVer(ver1):
"""Shorten the given version, dropping the trailing build ID to prevent artifact caching errors."""
return ".".join(ver1.split(".")[:-1])
@classmethod
def setUpClass(self) -> None:
url = "https://msedgedriver.azureedge.net/LATEST_STABLE"
if self.stable is None:
self.stable = self.fetch(url)
match = self.version_re.match(self.stable)
if not match:
raise ValueError(f"Invalid version string: {self.stable!r}")
major, minor, patch, build = match.groups()
self.major = major
url_latest = f"https://msedgedriver.azureedge.net/LATEST_RELEASE_{self.major}"
self.latest = self.fetch(url_latest)
return
def get_latest_os(self, major: str, _os: str) -> set[str]:
url = f"https://msedgedriver.azureedge.net/LATEST_RELEASE_{major}_{_os.upper()}"
opts = set()
for i in range(15):
# This endpoint occasionally returns an older cached value,
# so we have to fish for the cache to make testing more robust and cut down on false errors.
latest_mac = self.fetch(url)
opts.add(latest_mac)
time.sleep(0.25)
return opts
def test_get_latest_mac(self) -> None:
drvr, url, vers = edge.get_url("latest", _os="mac", _os_bit="64")
latest_macs = self.get_latest_os(self.major, "MACOS")
self.assertIn(vers, latest_macs)
def test_get_stable_mac(self) -> None:
drvr, url, vers = edge.get_url("stable", _os="mac", _os_bit="64")
self.assertEqual(vers, self.stable)
self.assertEqual(self.looseVer(vers), self.looseVer(self.stable))
self.assertTrue("edgedriver_mac64" in url, "The returned mac URL is not valid!")
def test_get_latest_linux(self) -> None:
drvr, url, vers = edge.get_url("latest", _os="linux", _os_bit="64")
latest_linux = self.get_latest_os(self.major, "LINUX")
self.assertIn(vers, latest_linux)
def test_get_stable_linux(self) -> None:
drvr, url, vers = edge.get_url("stable", _os="linux", _os_bit="64")
self.assertEqual(self.looseVer(vers), self.looseVer(self.stable))
self.assertTrue(
"edgedriver_linux64" in url, "The returned linux URL is not valid!"
)
def test_get_latest_windows(self) -> None:
drvr, url, vers = edge.get_url("latest", _os="win", _os_bit="64")
latest_wins = self.get_latest_os(self.major, "WINDOWS")
self.assertIn(vers, latest_wins)
def test_get_stable_windows(self) -> None:
drvr, url, vers = edge.get_url("stable", _os="win", _os_bit="64")
self.assertEqual(self.looseVer(vers), self.looseVer(self.stable))
self.assertTrue(
"edgedriver_win64" in url, "The returned windows URL is not valid!"
)
def test_get_major(self) -> None:
"""only proves url is created, not that it's valid"""
drvr, url, vers = edge.get_url(self.major, _os="mac", _os_bit="64")
self.assertEqual(vers, self.major)
self.assertEqual(
url,
f"https://msedgedriver.azureedge.net/{self.major}/edgedriver_mac64.zip",
)
def test_get_build(self) -> None:
match_latest = self.version_re.match(self.latest)
if not match_latest:
raise ValueError(f"Invalid version string: {self.latest!r}")
major_latest, minor_latest, patch_latest, build_latest = match_latest.groups()
self.major_latest = major_latest
drvr, url, vers = edge.get_url(self.latest, _os="mac", _os_bit="64")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://msedgedriver.azureedge.net/{self.latest}/edgedriver_mac64.zip",
)
def test_get_invalid_os(self) -> None:
with self.assertRaises(OSError) as exc:
edge.get_url("1.2.3.4", "lcars", "4096")
self.assertEqual(
str(exc.exception), "There is no valid EdgeDriver release for lcars"
)
def test_unresolved_version(self) -> None:
with self.assertRaises(Exception) as exc:
edge.get_url(None, _os="mac", _os_bit="64") # type: ignore[arg-type]
self.assertEqual(
str(exc.exception), "Unable to locate EdgeDriver version! [None]"
)
return
def test_get_url_mac_arm(self):
drvr, url, vers = edge.get_url(self.latest, _os="mac-arm", _os_bit="64")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://msedgedriver.azureedge.net/{self.latest}/edgedriver_mac64_m1.zip",
)
def test_get_url_mac_m1(self):
drvr, url, vers = edge.get_url(self.latest, _os="mac", _os_bit="64")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://msedgedriver.azureedge.net/{self.latest}/edgedriver_mac64.zip",
)
def test_get_url_mac_32(self):
drvr, url, vers = edge.get_url(self.latest, _os="mac", _os_bit="32")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://msedgedriver.azureedge.net/{self.latest}/edgedriver_mac32.zip",
)
def test_get_url_mac_86(self):
drvr, url, vers = edge.get_url(self.latest, _os="mac", _os_bit="64")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://msedgedriver.azureedge.net/{self.latest}/edgedriver_mac64.zip",
)
def test_get_url_win_32(self):
drvr, url, vers = edge.get_url(self.latest, _os="win", _os_bit="32")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://msedgedriver.azureedge.net/{self.latest}/edgedriver_win32.zip",
)
def test_get_url_win_64(self):
drvr, url, vers = edge.get_url(self.latest, _os="win", _os_bit="64")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://msedgedriver.azureedge.net/{self.latest}/edgedriver_win64.zip",
)
def test_get_url_linux_64(self):
drvr, url, vers = edge.get_url(self.latest, _os="linux", _os_bit="64")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://msedgedriver.azureedge.net/{self.latest}/edgedriver_linux64.zip",
)
def test_get_url_linux_32(self):
drvr, url, vers = edge.get_url(self.latest, _os="linux", _os_bit="32")
self.assertEqual(vers, self.latest)
self.assertEqual(
url,
f"https://msedgedriver.azureedge.net/{self.latest}/edgedriver_linux32.zip",
)
def test_get_url_unrecognized_version(self):
version = "abd.xyz"
drvr, url, vers = edge.get_url(version, _os="linux", _os_bit="32")
self.assertEqual(vers, version)
self.assertEqual(
url,
f"https://msedgedriver.azureedge.net/{version}/edgedriver_linux32.zip",
)
class TestFirefox(unittest.TestCase):
@staticmethod
def fetch(url: str) -> str:
resp = urlopen(url, timeout=15)
html = resp.read().decode("utf-8", errors="ignore").strip()
return str(html)
@classmethod
def setUpClass(self) -> None:
page = urlopen(
"https://github.com/mozilla/geckodriver/releases/latest", timeout=15
)
redirect = page.geturl()
version_string = redirect.split("/")[-1]
self.latest = version_string
return
def test_get_url_mac_arm(self):
drvr, url, vers = firefox.get_url(self.latest, _os="mac-arm", _os_bit="64")
self.assertEqual(vers, self.latest[1:])
self.assertEqual(
url,
f"https://github.com/mozilla/geckodriver/releases/download/"
f"{self.latest}/geckodriver-{self.latest}-macos-aarch64.tar.gz",
)
def test_get_url_mac_m1(self):
drvr, url, vers = firefox.get_url(self.latest, _os="mac", _os_bit="64")
self.assertEqual(vers, self.latest[1:])
self.assertEqual(
url,
f"https://github.com/mozilla/geckodriver/releases/download/"
f"{self.latest}/geckodriver-{self.latest}-macos.tar.gz",
)
def test_get_url_mac_32(self):
drvr, url, vers = firefox.get_url(self.latest, _os="mac", _os_bit="32")
self.assertEqual(vers, self.latest[1:])
self.assertEqual(
url,
f"https://github.com/mozilla/geckodriver/releases/download/"
f"{self.latest}/geckodriver-{self.latest}-macos.tar.gz",
)
def test_get_url_mac_86(self):
drvr, url, vers = firefox.get_url(self.latest, _os="mac", _os_bit="64")
self.assertEqual(vers, self.latest[1:])
self.assertEqual(
url,
f"https://github.com/mozilla/geckodriver/releases/download/"
f"{self.latest}/geckodriver-{self.latest}-macos.tar.gz",
)
def test_get_url_win_32(self):
drvr, url, vers = firefox.get_url(self.latest, _os="win", _os_bit="32")
self.assertEqual(vers, self.latest[1:])
self.assertEqual(
url,
f"https://github.com/mozilla/geckodriver/releases/download/"
f"{self.latest}/geckodriver-{self.latest}-win32.zip",
)
def test_get_url_win_64(self):
drvr, url, vers = firefox.get_url(self.latest, _os="win", _os_bit="64")
self.assertEqual(vers, self.latest[1:])
self.assertEqual(
url,
f"https://github.com/mozilla/geckodriver/releases/download/"
f"{self.latest}/geckodriver-{self.latest}-win64.zip",
)
def test_get_url_linux_64(self):
drvr, url, vers = firefox.get_url(self.latest, _os="linux", _os_bit="64")
self.assertEqual(vers, self.latest[1:])
self.assertEqual(
url,
f"https://github.com/mozilla/geckodriver/releases/download/"
f"{self.latest}/geckodriver-{self.latest}-linux64.tar.gz",
)
def test_get_url_linux_32(self):
drvr, url, vers = firefox.get_url(self.latest, _os="linux", _os_bit="32")
self.assertEqual(vers, self.latest[1:])
self.assertEqual(
url,
f"https://github.com/mozilla/geckodriver/releases/download/"
f"{self.latest}/geckodriver-{self.latest}-linux32.tar.gz",
)
def test_get_url_unrecognized_version(self):
version = "abd.xyz"
with self.assertRaises(Exception) as exc:
drvr, url, vers = firefox.get_url(version, _os="linux", _os_bit="32")
self.assertEqual(
str(exc.exception), f"Unable to download geckodriver version: v{version}"
)
def test_get_url_unrecognized_os(self):
version = self.latest
with self.assertRaises(Exception) as exc:
drvr, url, vers = firefox.get_url(version, _os="snoopy", _os_bit="32")
self.assertEqual(
str(exc.exception), f"Unable to locate FirefoxDriver version! [{version}]"
)
class TestOpera(unittest.TestCase):
@classmethod
def setUpClass(self) -> None:
page = urlopen(
"https://github.com/operasoftware/operachromiumdriver/releases/latest",
timeout=15,
)
redirect = page.geturl()
version_string = redirect.split("/")[-1]
self.latest = version_string
return
def test_get_url_mac_arm(self):
drvr, url, vers = opera.get_url(self.latest, _os="mac-arm", _os_bit="64")
self.assertEqual(vers, self.latest[2:])
self.assertEqual(
url,
f"https://github.com/operasoftware/operachromiumdriver/releases/download/"
f"{self.latest}/operadriver_mac64.zip",
)
def test_get_url_mac_32(self):
with self.assertRaises(Exception) as exc:
drvr, url, vers = opera.get_url(self.latest, _os="mac", _os_bit="32")
self.assertEqual(
str(exc.exception), f"Unable to locate OperaDriver version! [{self.latest}]"
)
def test_get_url_mac_86(self):
drvr, url, vers = opera.get_url(self.latest, _os="mac", _os_bit="64")
self.assertEqual(vers, self.latest[2:])
self.assertEqual(
url,
f"https://github.com/operasoftware/operachromiumdriver/releases/download/"
f"{self.latest}/operadriver_mac64.zip",
)
def test_get_url_win_32(self):
drvr, url, vers = opera.get_url(self.latest, _os="win", _os_bit="32")
self.assertEqual(vers, self.latest[2:])
self.assertEqual(
url,
f"https://github.com/operasoftware/operachromiumdriver/releases/download/"
f"{self.latest}/operadriver_win32.zip",
)
def test_get_url_win_64(self):
drvr, url, vers = opera.get_url(self.latest, _os="win", _os_bit="64")
self.assertEqual(vers, self.latest[2:])
self.assertEqual(
url,
f"https://github.com/operasoftware/operachromiumdriver/releases/download/"
f"{self.latest}/operadriver_win64.zip",
)
def test_get_url_linux_64(self):
drvr, url, vers = opera.get_url(self.latest, _os="linux", _os_bit="64")
self.assertEqual(vers, self.latest[2:])
self.assertEqual(
url,
f"https://github.com/operasoftware/operachromiumdriver/releases/download/"
f"{self.latest}/operadriver_linux64.zip",
)
def test_get_url_linux_32(self):
with self.assertRaises(Exception) as exc:
drvr, url, vers = opera.get_url(self.latest, _os="linux", _os_bit="32")
self.assertEqual(
str(exc.exception), f"Unable to locate OperaDriver version! [{self.latest}]"
)
def test_get_url_unrecognized_version(self):
version = "abd.xyz"
with self.assertRaises(Exception) as exc:
drvr, url, vers = firefox.get_url(version, _os="linux", _os_bit="32")
self.assertEqual(
str(exc.exception), f"Unable to download geckodriver version: v{version}"
)
class TestOperaPreChromium(unittest.TestCase):
@classmethod
def setUpClass(self) -> None:
self.version = "v.2.45"
return
def test_get_url_mac_arm(self):
drvr, url, vers = opera.get_url(self.version, _os="mac-arm", _os_bit="64")
self.assertEqual(vers, self.version[2:])
self.assertEqual(
url,
f"https://github.com/operasoftware/operachromiumdriver/releases/download/"
f"{self.version}/operadriver_mac64.zip",
)
return
def test_get_url_mac_32(self):
with self.assertRaises(Exception) as exc:
drvr, url, vers = opera.get_url(self.version, _os="mac", _os_bit="32")
self.assertEqual(
str(exc.exception),
f"Unable to locate OperaDriver version! [{self.version}]",
)
def test_get_url_mac_86(self):
drvr, url, vers = opera.get_url(self.version, _os="mac", _os_bit="64")
self.assertEqual(vers, self.version[2:])
self.assertEqual(
url,
f"https://github.com/operasoftware/operachromiumdriver/releases/download/"
f"{self.version}/operadriver_mac64.zip",
)
def test_get_url_win_32(self):
drvr, url, vers = opera.get_url(self.version, _os="win", _os_bit="32")
self.assertEqual(vers, self.version[2:])
self.assertEqual(
url,
f"https://github.com/operasoftware/operachromiumdriver/releases/download/"
f"{self.version}/operadriver_win32.zip",
)
def test_get_url_win_64(self):
drvr, url, vers = opera.get_url(self.version, _os="win", _os_bit="64")
self.assertEqual(vers, self.version[2:])
self.assertEqual(
url,
f"https://github.com/operasoftware/operachromiumdriver/releases/download/"
f"{self.version}/operadriver_win64.zip",
)
def test_get_url_linux_64(self):
drvr, url, vers = opera.get_url(self.version, _os="linux", _os_bit="64")
self.assertEqual(vers, self.version[2:])
self.assertEqual(
url,
f"https://github.com/operasoftware/operachromiumdriver/releases/download/"
f"{self.version}/operadriver_linux64.zip",
)
def test_get_url_linux_32(self):
with self.assertRaises(Exception) as exc:
drvr, url, vers = opera.get_url(self.version, _os="linux", _os_bit="32")
self.assertEqual(
str(exc.exception),
f"Unable to locate OperaDriver version! [{self.version}]",
)
def test_get_url_unrecognized_version(self):
version = "abd.xyz"
with self.assertRaises(Exception) as exc:
drvr, url, vers = firefox.get_url(version, _os="linux", _os_bit="32")
self.assertEqual(
str(exc.exception), f"Unable to download geckodriver version: v{version}"
)
if __name__ == "__main__":
unittest.main()