add first test
All checks were successful
check code / check-code (push) Successful in 33s

This commit is contained in:
Ivan Schaller 2024-02-21 14:59:19 +01:00
parent 880a210b9b
commit 3728594b4e
6 changed files with 36 additions and 4 deletions

View file

@ -11,4 +11,4 @@ jobs:
check-code: check-code:
uses: actions/workflows/.gitea/workflows/check_python_hatch.yml@master uses: actions/workflows/.gitea/workflows/check_python_hatch.yml@master
with: with:
run-tests: false run-tests: true

View file

@ -26,3 +26,6 @@ jobs:
- name: test typing - name: test typing
run: hatch run lint:typing run: hatch run lint:typing
- name: test typing
run: hatch run default:test

View file

@ -1,3 +0,0 @@
octodns==1.4.0
octodns-spf==0.0.2
octodns-netbox-dns==0.3.3

View file

@ -57,6 +57,9 @@ check:
build: build:
hatch build --clean hatch build --clean
test:
hatch run default:test
up: up:
docker compose -f dev/compose.yml up docker compose -f dev/compose.yml up

View file

@ -50,6 +50,8 @@ python = "3.11"
dependencies = [ dependencies = [
"pytest==7.4.4", "pytest==7.4.4",
"coverage==7.4.2", "coverage==7.4.2",
"octodns==1.4.0",
"octodns-spf==0.0.2",
] ]
[tool.hatch.envs.default.scripts] [tool.hatch.envs.default.scripts]

27
tests/test_source.py Normal file
View file

@ -0,0 +1,27 @@
from octodns_netbox_dns import NetBoxDNSSource
DEFAULT_CONFIG = {
"id": 1,
"url": "https://localhost:8000",
"token": "",
"view": False,
"replace_duplicates": False,
"make_absolute": True,
}
def test_absolute1():
nbdns = NetBoxDNSSource(**DEFAULT_CONFIG)
rcd = "example.com"
absolute = nbdns._make_absolute(rcd)
assert absolute == "example.com."
def test_absolute2():
nbdns = NetBoxDNSSource(**DEFAULT_CONFIG)
rcd = "example.com."
absolute = nbdns._make_absolute(rcd)
assert absolute == "example.com."