Skip to content

Commit

Permalink
Merge pull request #112 from stfc/further_changes
Browse files Browse the repository at this point in the history
Change default rack height to 0
  • Loading branch information
khalford committed Oct 30, 2023
2 parents 1c70fb3 + dd41ee4 commit 1a5908a
Show file tree
Hide file tree
Showing 25 changed files with 17 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ on:
- master
pull_request:
paths:
- "Pynetbox_Data_Uploader/**"
- ".github/workflows/Pynetbox.yaml"
- "pynetbox_data_uploader/**"
- ".github/workflows/pynetbox.yaml"

jobs:
test_and_lint:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.x"]
python-version: ["3.8", "3.x"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -26,20 +26,18 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r Pynetbox_Data_Uploader/requirements.txt
- name: Run tests
run: cd Pynetbox_Data_Uploader && python3 -m pytest .
cd pynetbox_data_uploader
pip install -r requirements.txt
- name: Analyse with pylint
run: |
cd Pynetbox_Data_Uploader && pylint $(git ls-files '*.py') --rcfile=.pylintrc
run: cd pynetbox_data_uploader && pylint . --rcfile=.pylintrc

- name: Run tests and collect coverage
run: cd Pynetbox_Data_Uploader && python3 -m pytest --cov-report xml:coverage.xml --cov
run: cd pynetbox_data_uploader && python3 -m pytest --cov-report xml:coverage.xml --cov

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./Pynetbox_Data_Uploader/coverage.xml
files: ./pynetbox_data_uploader/coverage.xml

20 changes: 0 additions & 20 deletions Pynetbox_Data_Uploader/setup.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ class NetboxCreate:
"""

def __init__(self, api):
"""
This initialises the method with the api object.
:param api:
"""
self.netbox = api

def create_device(self, data: Union[Dict, List]) -> bool:
Expand All @@ -19,14 +23,14 @@ def create_device(self, data: Union[Dict, List]) -> bool:
return bool(devices)

def create_device_type(
self, model: str, slug: str, manufacturer: str, u_height: int = 1
self, model: str, slug: str, manufacturer: str, u_height: int = 0
) -> bool:
"""
This method creates a new device type in Netbox.
:param model: The model name of the device.
:param slug: The URL friendly version of the model name.
:param manufacturer: The manufacturer of the device.
:param u_height: This it the height of the device in the rack. Default 1.
:param u_height: This is the height of the device in the rack. Default 0.
:return: Returns bool.
"""
device_type = self.netbox.dcim.device_types.create(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[pytest]
pythonpath = lib
testpaths = Tests
testpaths = tests
python_files = *.py
python_functions = test_*
addopts = --ignore=setup.py
Binary file not shown.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ def test_create_device_type(instance):
model=mock_model, manufacturer=mock_manufacturer, slug=mock_slug
)
mock_device_types.create.assert_called_once_with(
model=mock_model, slug=mock_slug, manufacturer=mock_manufacturer, u_height=1
model=mock_model, slug=mock_slug, manufacturer=mock_manufacturer, u_height=0
)

0 comments on commit 1a5908a

Please sign in to comment.