mirror of
https://github.com/netbox-community/devicetype-library.git
synced 2025-08-08 22:54:52 +02:00
PR CI Testing (#1472)
* Pytest Optimizations (#1465) * Adding function to determin file changes from upstream via git * updated test env function to properly skip when files are empty * updating to use generated slug list * fixing if statement * added known slugs functionality to improve runtime * updating slugs for using git repo * adding final changes * updating library url to be correct * Update master-slugs.yml * commit to force pr merge (#1466) * Pytest pr (#1467) * commit to force pr merge * commit to force pr merge * Update master-slugs.yml * Regenerate master slug list after successful PR merge * Update master-slugs.yml * fianl changes to new master slug workflow (#1468) * Final pr test (#1469) * fianl changes to new master slug workflow * trying new branch push * changing to myself (#1470) * testing permission on github_token * testing permission on github_token --------- Co-authored-by: NetBox Bot <info@netboxlabs.com>
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
from test_configuration import KNOWN_SLUGS
|
||||
import os
|
||||
|
||||
class DeviceType:
|
||||
@ -41,9 +40,18 @@ class DeviceType:
|
||||
def get_filepath(self):
|
||||
return self.file_path
|
||||
|
||||
def verify_slug(self):
|
||||
def verify_slug(self, KNOWN_SLUGS):
|
||||
# Verify the slug is unique, and not already known
|
||||
if self.slug in KNOWN_SLUGS:
|
||||
known_slug_list_intersect = [(slug, file_path) for slug, file_path in KNOWN_SLUGS if slug == self.slug]
|
||||
|
||||
if len(known_slug_list_intersect) == 0:
|
||||
pass
|
||||
elif len(known_slug_list_intersect) == 1:
|
||||
if self.file_path not in known_slug_list_intersect[0][1]:
|
||||
self.failureMessage = f'{self.file_path} has a duplicate slug: "{self.slug}"'
|
||||
return False
|
||||
return True
|
||||
else:
|
||||
self.failureMessage = f'{self.file_path} has a duplicate slug "{self.slug}"'
|
||||
return False
|
||||
|
||||
@ -58,7 +66,7 @@ class DeviceType:
|
||||
return False
|
||||
|
||||
# Add the slug to the list of known slugs
|
||||
KNOWN_SLUGS.add(self.slug)
|
||||
KNOWN_SLUGS.add((self.slug, self.file_path))
|
||||
return True
|
||||
|
||||
def validate_power(self):
|
||||
|
Reference in New Issue
Block a user