This was completely unnecessary and took me hours, but I wanted to flex my one-liner skills...
This commit is contained in:
parent
fd2a56fac4
commit
e4112b5d3f
14
tests/test_suite/identity_block.py
Executable file
14
tests/test_suite/identity_block.py
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
# Necessary imports
|
||||||
|
from robot.api.logger import info
|
||||||
|
from yaml import load, Loader
|
||||||
|
|
||||||
|
|
||||||
|
def load_data():
|
||||||
|
# This saves us going to like two buttons
|
||||||
|
with open('/data/identities.yml') as data_yaml:
|
||||||
|
data_dict = load(data_yaml, Loader=Loader)
|
||||||
|
|
||||||
|
# Here's the worst one-liner I've written in my whole career, enjoy
|
||||||
|
return {list(fuck)[0]: fuck[list(fuck)[0]] for fuck in [{z: {y[list(y)[0]]['url']: y for y in [{x: data_dict[x]} for x in data_dict]}[z] for z in {y[list(y)[0]]['url']: y for y in [{x: data_dict[x]} for x in data_dict]} if z != ''}[x] for x in {z: {y[list(y)[0]]['url']: y for y in [{x: data_dict[x]} for x in data_dict]}[z] for z in {y[list(y)[0]]['url']: y for y in [{x: data_dict[x]} for x in data_dict]} if z != ''}]}
|
@ -5,7 +5,6 @@ from robot.api.logger import info
|
|||||||
from shared_methods import load_data, check_buttons, standardize_url
|
from shared_methods import load_data, check_buttons, standardize_url
|
||||||
import footer_test
|
import footer_test
|
||||||
|
|
||||||
|
|
||||||
def execute_tests(driver, site_url):
|
def execute_tests(driver, site_url):
|
||||||
filepaths = ['/data/pages.yml', '/data/identities.yml']
|
filepaths = ['/data/pages.yml', '/data/identities.yml']
|
||||||
data = load_data(filepaths)
|
data = load_data(filepaths)
|
||||||
|
@ -7,6 +7,7 @@ from selenium.webdriver.common.by import By
|
|||||||
from robot.api.logger import info, error
|
from robot.api.logger import info, error
|
||||||
from yaml import load, Loader
|
from yaml import load, Loader
|
||||||
import time
|
import time
|
||||||
|
import identity_block
|
||||||
|
|
||||||
|
|
||||||
def standardize_url(url):
|
def standardize_url(url):
|
||||||
@ -27,11 +28,14 @@ def load_data(filepaths):
|
|||||||
data = {}
|
data = {}
|
||||||
for filepath in filepaths:
|
for filepath in filepaths:
|
||||||
try:
|
try:
|
||||||
with open(filepath) as yaml_doc:
|
if (filepath == '/data/identities.yml'):
|
||||||
data.update(load(yaml_doc, Loader=Loader))
|
data.update(identity_block.load_data())
|
||||||
|
else:
|
||||||
|
with open(filepath) as yaml_doc:
|
||||||
|
data.update(load(yaml_doc, Loader=Loader))
|
||||||
|
|
||||||
with open('/data/homepage/other.yml') as yaml_doc:
|
# with open('/data/homepage/other.yml') as yaml_doc:
|
||||||
data.update(load(yaml_doc, Loader=Loader))
|
# data.update(load(yaml_doc, Loader=Loader))
|
||||||
except:
|
except:
|
||||||
error("Couldn't open or parse the yaml document.")
|
error("Couldn't open or parse the yaml document.")
|
||||||
return {}
|
return {}
|
||||||
|
Loading…
Reference in New Issue
Block a user