From cfbc3ec22328e264931bb3bc634ecf5451464eaf Mon Sep 17 00:00:00 2001
From: "Daniel W. Anner" <daniel.anner@danstechsupport.com>
Date: Tue, 1 Aug 2023 12:02:16 -0400
Subject: [PATCH] Jpsu fix (#1520)

* Added test functionality to use original all files testing. Fixed JPSU-920-AC-AFO issue from Issue#1514

* Fixed JPSU issue

* Fixing file format issue

* fixing file we altered by accident
---
 module-types/Juniper/JPSU-920-AC-AFO.yaml |  7 +++++++
 module-types/Juniper/jpsu-920-ac-afo.yaml | 16 ----------------
 tests/definitions_test.py                 |  7 +++++--
 tests/test_configuration.py               |  1 +
 4 files changed, 13 insertions(+), 18 deletions(-)
 delete mode 100644 module-types/Juniper/jpsu-920-ac-afo.yaml

diff --git a/module-types/Juniper/JPSU-920-AC-AFO.yaml b/module-types/Juniper/JPSU-920-AC-AFO.yaml
index b4570330..f8ea07c5 100644
--- a/module-types/Juniper/JPSU-920-AC-AFO.yaml
+++ b/module-types/Juniper/JPSU-920-AC-AFO.yaml
@@ -1,8 +1,15 @@
 ---
 manufacturer: Juniper
 model: JPSU-920-AC-AFO
+part_number: 640-060601
 comments: |
   EX Series 920 W AC power supply (front-to-back airflow)
+
+  Compatible with
+  * EX3400 PoE models
+  * EX4100 PoE models
+
+  [Juniper EX4100 Data Sheet](https://www.juniper.net/content/dam/www/assets/datasheets/us/en/switches/ex4100-line-of-ethernet-switches-datasheet.pdf)
 power-ports:
   - name: Power Supply {module}
     type: iec-60320-c14
diff --git a/module-types/Juniper/jpsu-920-ac-afo.yaml b/module-types/Juniper/jpsu-920-ac-afo.yaml
deleted file mode 100644
index f8ea07c5..00000000
--- a/module-types/Juniper/jpsu-920-ac-afo.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
----
-manufacturer: Juniper
-model: JPSU-920-AC-AFO
-part_number: 640-060601
-comments: |
-  EX Series 920 W AC power supply (front-to-back airflow)
-
-  Compatible with
-  * EX3400 PoE models
-  * EX4100 PoE models
-
-  [Juniper EX4100 Data Sheet](https://www.juniper.net/content/dam/www/assets/datasheets/us/en/switches/ex4100-line-of-ethernet-switches-datasheet.pdf)
-power-ports:
-  - name: Power Supply {module}
-    type: iec-60320-c14
-    maximum_draw: 920
diff --git a/tests/definitions_test.py b/tests/definitions_test.py
index ab5f61fa..3105c098 100644
--- a/tests/definitions_test.py
+++ b/tests/definitions_test.py
@@ -1,4 +1,4 @@
-from test_configuration import COMPONENT_TYPES, IMAGE_FILETYPES, SCHEMAS, KNOWN_SLUGS, ROOT_DIR, USE_LOCAL_KNOWN_SLUGS, NETBOX_DT_LIBRARY_URL, KNOWN_MODULES
+from test_configuration import COMPONENT_TYPES, IMAGE_FILETYPES, SCHEMAS, KNOWN_SLUGS, ROOT_DIR, USE_LOCAL_KNOWN_SLUGS, NETBOX_DT_LIBRARY_URL, KNOWN_MODULES, USE_UPSTREAM_DIFF
 import pickle_operations
 from yaml_loader import DecimalSafeLoader
 from device_types import DeviceType, ModuleType, verify_filename, validate_components
@@ -105,7 +105,10 @@ def test_environment():
     if definition_files:
         pytest.skip("No changes to definition files found.")
 
-definition_files = _get_diff_from_upstream()
+if USE_UPSTREAM_DIFF:
+    definition_files = _get_diff_from_upstream()
+else:
+    definition_files = _get_definition_files()
 image_files = _get_image_files()
 
 if USE_LOCAL_KNOWN_SLUGS:
diff --git a/tests/test_configuration.py b/tests/test_configuration.py
index b2835790..afae3845 100644
--- a/tests/test_configuration.py
+++ b/tests/test_configuration.py
@@ -27,5 +27,6 @@ KNOWN_SLUGS = set()
 KNOWN_MODULES = set()
 
 USE_LOCAL_KNOWN_SLUGS = False
+USE_UPSTREAM_DIFF = True
 
 NETBOX_DT_LIBRARY_URL = "https://github.com/netbox-community/devicetype-library.git"
\ No newline at end of file
-- 
GitLab