From e4112b5d3f415a4bbc970e3906a3499a44b22e15 Mon Sep 17 00:00:00 2001
From: Ada Werefox <ada.werefox@tutanota.com>
Date: Sat, 28 Jan 2023 18:26:26 +0000
Subject: [PATCH] This was completely unnecessary and took me hours, but I
 wanted to flex my one-liner skills...

---
 tests/test_suite/identity_block.py        | 14 ++++++++++++++
 tests/test_suite/info_root_domain_test.py |  1 -
 tests/test_suite/shared_methods.py        | 12 ++++++++----
 3 files changed, 22 insertions(+), 5 deletions(-)
 create mode 100755 tests/test_suite/identity_block.py

diff --git a/tests/test_suite/identity_block.py b/tests/test_suite/identity_block.py
new file mode 100755
index 0000000..2233158
--- /dev/null
+++ b/tests/test_suite/identity_block.py
@@ -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 != ''}]}
diff --git a/tests/test_suite/info_root_domain_test.py b/tests/test_suite/info_root_domain_test.py
index b41b646..80da265 100755
--- a/tests/test_suite/info_root_domain_test.py
+++ b/tests/test_suite/info_root_domain_test.py
@@ -5,7 +5,6 @@ from robot.api.logger import info
 from shared_methods import load_data, check_buttons, standardize_url
 import footer_test
 
-
 def execute_tests(driver, site_url):
     filepaths = ['/data/pages.yml', '/data/identities.yml']
     data = load_data(filepaths)
diff --git a/tests/test_suite/shared_methods.py b/tests/test_suite/shared_methods.py
index acfb885..5793317 100755
--- a/tests/test_suite/shared_methods.py
+++ b/tests/test_suite/shared_methods.py
@@ -7,6 +7,7 @@ from selenium.webdriver.common.by import By
 from robot.api.logger import info, error
 from yaml import load, Loader
 import time
+import identity_block
 
 
 def standardize_url(url):
@@ -27,11 +28,14 @@ def load_data(filepaths):
     data = {}
     for filepath in filepaths:
         try:
-            with open(filepath) as yaml_doc:
-                data.update(load(yaml_doc, Loader=Loader))
+            if (filepath == '/data/identities.yml'):
+                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:
-                data.update(load(yaml_doc, Loader=Loader))
+            # with open('/data/homepage/other.yml') as yaml_doc:
+            #     data.update(load(yaml_doc, Loader=Loader))
         except:
             error("Couldn't open or parse the yaml document.")
             return {}