Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
poetry skeletone started
Browse files Browse the repository at this point in the history
  • Loading branch information
falkowich committed May 6, 2023
1 parent 196484c commit 36b90c0
Show file tree
Hide file tree
Showing 13 changed files with 2,317 additions and 121 deletions.
File renamed without changes.
1,174 changes: 1,174 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions pyiseers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import json
import os
import re
from furl import furl
from datetime import datetime, timedelta
from urllib.parse import quote

import requests
from furl import furl

base_dir = os.path.dirname(__file__)

Expand Down Expand Up @@ -1963,7 +1963,6 @@ def update_device( # noqa C901
disable_snmp=False,
device_payload=None,
):

"""
Update a Network Device with provided settings.
Expand Down
28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[tool.poetry]
name = "pyise-ers"
version = "0.3-dev"
description = "ISE-ERS API Wrapper"
authors = ["Falk <falk@mockel.se>"]
license = "GPL"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
requests = "*"
furl = "*"


[tool.poetry.group.dev.dependencies]
flake8 = "*"
pytest = "*"
black = "*"
pytest-cov = "*"
ptpython = "*"
codecov = "*"
setuptools = "^67.7.2"
twine = "^4.0.2"
wheel = "^0.40.0"
isort = "^5.12.0"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
24 changes: 0 additions & 24 deletions requirements-dev.txt

This file was deleted.

8 changes: 8 additions & 0 deletions requirements-prod.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
certifi==2022.12.7 ; python_version >= "3.10" and python_version < "4.0"
charset-normalizer==3.1.0 ; python_version >= "3.10" and python_version < "4.0"
furl==2.1.3 ; python_version >= "3.10" and python_version < "4.0"
idna==3.4 ; python_version >= "3.10" and python_version < "4.0"
orderedmultidict==1.0.1 ; python_version >= "3.10" and python_version < "4.0"
requests==2.29.0 ; python_version >= "3.10" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.10" and python_version < "4.0"
urllib3==1.26.15 ; python_version >= "3.10" and python_version < "4.0"
6 changes: 3 additions & 3 deletions requirements-publish-pypi.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
setuptools==58.2.0
twine==3.4.2
wheel==0.37.0
setuptools
twine
wheel
80 changes: 66 additions & 14 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,66 @@
################################################################################
# This requirements file has been automatically generated from `Pipfile` with
# `pipenv-to-requirements`
#
#
# This has been done to maintain backward compatibility with tools and services
# that do not support `Pipfile` yet.
#
# Do NOT edit it directly, use `pipenv install [-d]` to modify `Pipfile` and
# `Pipfile.lock` and then regenerate `requirements*.txt`.
################################################################################

furl
requests
appdirs==1.4.4 ; python_version >= "3.10" and python_version < "4.0"
attrs==23.1.0 ; python_version >= "3.10" and python_version < "4.0"
black==23.3.0 ; python_version >= "3.10" and python_version < "4.0"
bleach==6.0.0 ; python_version >= "3.10" and python_version < "4.0"
certifi==2022.12.7 ; python_version >= "3.10" and python_version < "4.0"
cffi==1.15.1 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "linux"
charset-normalizer==3.1.0 ; python_version >= "3.10" and python_version < "4.0"
click==8.1.3 ; python_version >= "3.10" and python_version < "4.0"
codecov==2.1.13 ; python_version >= "3.10" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "win32" or python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
coverage==7.2.5 ; python_version >= "3.10" and python_version < "4.0"
coverage[toml]==7.2.5 ; python_version >= "3.10" and python_version < "4.0"
cryptography==40.0.2 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "linux"
docutils==0.19 ; python_version >= "3.10" and python_version < "4.0"
exceptiongroup==1.1.1 ; python_version >= "3.10" and python_version < "3.11"
flake8==6.0.0 ; python_version >= "3.10" and python_version < "4.0"
furl==2.1.3 ; python_version >= "3.10" and python_version < "4.0"
idna==3.4 ; python_version >= "3.10" and python_version < "4.0"
importlib-metadata==6.6.0 ; python_version >= "3.10" and python_version < "4.0"
iniconfig==2.0.0 ; python_version >= "3.10" and python_version < "4.0"
jaraco-classes==3.2.3 ; python_version >= "3.10" and python_version < "4.0"
jedi==0.18.2 ; python_version >= "3.10" and python_version < "4.0"
jeepney==0.8.0 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "linux"
keyring==23.13.1 ; python_version >= "3.10" and python_version < "4.0"
markdown-it-py==2.2.0 ; python_version >= "3.10" and python_version < "4.0"
mccabe==0.7.0 ; python_version >= "3.10" and python_version < "4.0"
mdurl==0.1.2 ; python_version >= "3.10" and python_version < "4.0"
more-itertools==9.1.0 ; python_version >= "3.10" and python_version < "4.0"
multidict==6.0.4 ; python_version >= "3.10" and python_version < "4.0"
mypy-extensions==1.0.0 ; python_version >= "3.10" and python_version < "4.0"
orderedmultidict==1.0.1 ; python_version >= "3.10" and python_version < "4.0"
packaging==23.1 ; python_version >= "3.10" and python_version < "4.0"
parso==0.8.3 ; python_version >= "3.10" and python_version < "4.0"
pathspec==0.11.1 ; python_version >= "3.10" and python_version < "4.0"
pkginfo==1.9.6 ; python_version >= "3.10" and python_version < "4.0"
platformdirs==3.5.0 ; python_version >= "3.10" and python_version < "4.0"
pluggy==1.0.0 ; python_version >= "3.10" and python_version < "4.0"
prompt-toolkit==3.0.38 ; python_version >= "3.10" and python_version < "4.0"
ptpython==3.0.23 ; python_version >= "3.10" and python_version < "4.0"
pycodestyle==2.10.0 ; python_version >= "3.10" and python_version < "4.0"
pycparser==2.21 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "linux"
pyflakes==3.0.1 ; python_version >= "3.10" and python_version < "4.0"
pygments==2.15.1 ; python_version >= "3.10" and python_version < "4.0"
pytest-cov==4.0.0 ; python_version >= "3.10" and python_version < "4.0"
pytest-recording==0.12.2 ; python_version >= "3.10" and python_version < "4.0"
pytest==7.3.1 ; python_version >= "3.10" and python_version < "4.0"
pywin32-ctypes==0.2.0 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "win32"
pyyaml==6.0 ; python_version >= "3.10" and python_version < "4.0"
readme-renderer==37.3 ; python_version >= "3.10" and python_version < "4.0"
requests-toolbelt==1.0.0 ; python_version >= "3.10" and python_version < "4.0"
requests==2.29.0 ; python_version >= "3.10" and python_version < "4.0"
rfc3986==2.0.0 ; python_version >= "3.10" and python_version < "4.0"
rich==13.3.5 ; python_version >= "3.10" and python_version < "4.0"
secretstorage==3.3.3 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "linux"
setuptools==67.7.2 ; python_version >= "3.10" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.10" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.10" and python_full_version <= "3.11.0a6"
twine==4.0.2 ; python_version >= "3.10" and python_version < "4.0"
urllib3==1.26.15 ; python_version >= "3.10" and python_version < "4.0"
vcrpy==4.2.1 ; python_version >= "3.10" and python_version < "4.0"
wcwidth==0.2.6 ; python_version >= "3.10" and python_version < "4.0"
webencodings==0.5.1 ; python_version >= "3.10" and python_version < "4.0"
wheel==0.40.0 ; python_version >= "3.10" and python_version < "4.0"
wrapt==1.15.0 ; python_version >= "3.10" and python_version < "4.0"
yarl==1.9.2 ; python_version >= "3.10" and python_version < "4.0"
zipp==3.15.0 ; python_version >= "3.10" and python_version < "4.0"
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from setuptools import find_packages, setup

# read the contents of your README file
from os import path

from setuptools import find_packages, setup

this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
Expand Down
49 changes: 35 additions & 14 deletions test/manual_test_ers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@

sys.path.append("./")

from pyiseers import ERS # noqa E402
from pprint import pprint # noqa E402

from config import ( # noqa E402
uri_27,
uri_30,
device,
device_group,
device_payload,
endpoint,
endpoint_group,
user,
identity_group,
device,
device_group,
trustsec,
device_payload,
uri_27,
uri_30,
uri_31,
user,
)

from pyiseers import ERS # noqa E402


def test_groups():
groups = ise.get_endpoint_groups()["response"]
Expand Down Expand Up @@ -71,6 +74,23 @@ def get_endpoint_groups(size):
print("get_endpoint_groups » OK")


def add_endpoint_group(endpoint_group):
test = ise.add_endpoint_group(endpoint_group["name"], endpoint_group["description"])
if test["error"]:
print(test["response"])
else:
print("add_endpoint_group » OK")


def delete_endpoint_group(endpoint_group):
r1 = ise.get_endpoint_group(endpoint_group["name"])
test = ise.delete_endpoint_group(r1["response"]["id"])
if test["error"]:
print(test["response"])
else:
print("delete_endpoint_group » OK")


def get_endpoint_group(endpoint_group):
test = ise.get_endpoint_group(endpoint_group["name"])
if test["error"]:
Expand Down Expand Up @@ -191,9 +211,8 @@ def update_device_group(device_group_id):


def delete_device_group():
test = ise.delete_device_group(
name="Device Type#All Device Types#Updated Device Type"
)
#r1 = ise.get_device_group(name="Device Type#All Device Types#Updated Device Type")
test = ise.delete_device_group(name="Device Type#All Device Types#Updated Device Type")
if test["error"]:
print(test["response"])
else:
Expand Down Expand Up @@ -451,13 +470,13 @@ def delete_emc(id):

if __name__ == "__main__":
ise = ERS(
ise_node=uri_27["ise_node"],
ers_user=uri_27["ers_user"],
ers_pass=uri_27["ers_pass"],
ise_node=uri_31["ise_node"],
ers_user=uri_31["ers_user"],
ers_pass=uri_31["ers_pass"],
verify=False,
disable_warnings=True,
timeout=15,
use_csrf=uri_27["use_csrf"],
use_csrf=uri_31["use_csrf"],
)

print(f"Testing {ise.ise_node}")
Expand All @@ -469,8 +488,10 @@ def delete_emc(id):
delete_endpoint(endpoint)

# EndpointGroup tests
add_endpoint_group(endpoint_group)
get_endpoint_groups(21)
get_endpoint_group(endpoint_group)
delete_endpoint_group(endpoint_group)

# User tests
get_identity_groups()
Expand Down
Loading

0 comments on commit 36b90c0

Please sign in to comment.