Merge branch 'main' into development
This commit is contained in:
commit
8157eb1b3a
8 changed files with 24 additions and 20 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
[run]
|
[run]
|
||||||
source = ./ip_listener/
|
source = ./transip_client/
|
||||||
omit =
|
omit =
|
||||||
**/tests/**
|
**/tests/**
|
||||||
**/tests.py
|
**/tests.py
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ line_length = 88
|
||||||
multi_line_output = 3
|
multi_line_output = 3
|
||||||
skip = env/, venv/
|
skip = env/, venv/
|
||||||
default_section = THIRDPARTY
|
default_section = THIRDPARTY
|
||||||
known_first_party = ip_listener
|
known_first_party = transip_client
|
||||||
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
|
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
|
||||||
lines_between_types=1
|
lines_between_types=1
|
||||||
lines_after_imports=2
|
lines_after_imports=2
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.2.0
|
||||||
|
|
||||||
|
- Rename project
|
||||||
|
|
||||||
## 0.1.1
|
## 0.1.1
|
||||||
|
|
||||||
- Fix gitlab ci include path
|
- Fix gitlab ci include path
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "ip-listener"
|
name = "transip_client"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
description = "Listens for changes about the current public IP and acts upon it."
|
description = "Listens for changes about the current public IP and acts upon it."
|
||||||
authors = ["sonny <sonnyba871@gmail.com>"]
|
authors = ["sonny <sonnyba871@gmail.com>"]
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
|
|
@ -22,7 +22,7 @@ autoflake = "^1.4"
|
||||||
coverage = "^5.3.1"
|
coverage = "^5.3.1"
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
listen = "ip_listener.cli:run"
|
listen = "transip_client.cli:run"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry>=0.12"]
|
requires = ["poetry>=0.12"]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from ip_listener.main import detect
|
from transip_client.main import detect
|
||||||
|
|
||||||
DEFAULT_DNS = "myip.opendns.com"
|
DEFAULT_DNS = "myip.opendns.com"
|
||||||
DEFAULT_DNS_NAME = "@resolver1.opendns.com"
|
DEFAULT_DNS_NAME = "@resolver1.opendns.com"
|
||||||
|
|
@ -7,18 +7,18 @@ from click.testing import CliRunner
|
||||||
from pkg_resources import get_distribution
|
from pkg_resources import get_distribution
|
||||||
from requests import HTTPError
|
from requests import HTTPError
|
||||||
|
|
||||||
from ip_listener.cli import DEFAULT_API_URL, run
|
from transip_client.cli import DEFAULT_API_URL, run
|
||||||
|
|
||||||
|
|
||||||
class RunTestCase(TestCase):
|
class RunTestCase(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
patcher = patch("ip_listener.main.subprocess.check_output")
|
patcher = patch("transip_client.main.subprocess.check_output")
|
||||||
self.mocked_dns = patcher.start()
|
self.mocked_dns = patcher.start()
|
||||||
|
|
||||||
patcher = patch("ip_listener.main.requests.get")
|
patcher = patch("transip_client.main.requests.get")
|
||||||
self.mocked_get = patcher.start()
|
self.mocked_get = patcher.start()
|
||||||
|
|
||||||
patcher = patch("ip_listener.main.requests.put")
|
patcher = patch("transip_client.main.requests.put")
|
||||||
self.mocked_put = patcher.start()
|
self.mocked_put = patcher.start()
|
||||||
|
|
||||||
self.runner = CliRunner()
|
self.runner = CliRunner()
|
||||||
|
|
@ -46,11 +46,11 @@ class RunTestCase(TestCase):
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
with self.assertLogs("ip_listener.main", level="INFO") as logger:
|
with self.assertLogs("transip_client.main", level="INFO") as logger:
|
||||||
result = self.runner.invoke(run, ["foobar.com", "TOKEN"])
|
result = self.runner.invoke(run, ["foobar.com", "TOKEN"])
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
logger.output, ["INFO:ip_listener.main:Updated domain foobar.com"]
|
logger.output, ["INFO:transip_client.main:Updated domain foobar.com"]
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
|
|
@ -83,7 +83,7 @@ class RunTestCase(TestCase):
|
||||||
self.mocked_dns.return_value = b"111.420\n"
|
self.mocked_dns.return_value = b"111.420\n"
|
||||||
self.mocked_get.return_value.raise_for_status.side_effect = HTTPError
|
self.mocked_get.return_value.raise_for_status.side_effect = HTTPError
|
||||||
|
|
||||||
with self.assertLogs("ip_listener.main", level="INFO") as logger:
|
with self.assertLogs("transip_client.main", level="INFO") as logger:
|
||||||
result = self.runner.invoke(run, ["foobar.com", "TOKEN"])
|
result = self.runner.invoke(run, ["foobar.com", "TOKEN"])
|
||||||
|
|
||||||
error_log = logger.output[0]
|
error_log = logger.output[0]
|
||||||
|
|
@ -189,13 +189,13 @@ class RunTestCase(TestCase):
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
with self.assertLogs("ip_listener.main", level="INFO") as logger:
|
with self.assertLogs("transip_client.main", level="INFO") as logger:
|
||||||
result = self.runner.invoke(
|
result = self.runner.invoke(
|
||||||
run, ["foobar.com", "TOKEN", "--api-url", "https://other-provider.com"]
|
run, ["foobar.com", "TOKEN", "--api-url", "https://other-provider.com"]
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
logger.output, ["INFO:ip_listener.main:Updated domain foobar.com"]
|
logger.output, ["INFO:transip_client.main:Updated domain foobar.com"]
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
|
|
@ -247,13 +247,13 @@ class RunTestCase(TestCase):
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
with self.assertLogs("ip_listener.main", level="INFO") as logger:
|
with self.assertLogs("transip_client.main", level="INFO") as logger:
|
||||||
result = self.runner.invoke(
|
result = self.runner.invoke(
|
||||||
run, ["foobar.com", "TOKEN"], env={"API_URL": "https://new-api.com"}
|
run, ["foobar.com", "TOKEN"], env={"API_URL": "https://new-api.com"}
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
logger.output, ["INFO:ip_listener.main:Updated domain foobar.com"]
|
logger.output, ["INFO:transip_client.main:Updated domain foobar.com"]
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
|
|
@ -332,7 +332,7 @@ class RunTestCase(TestCase):
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
with self.assertLogs("ip_listener.main", level="INFO") as logger:
|
with self.assertLogs("transip_client.main", level="INFO") as logger:
|
||||||
result = self.runner.invoke(
|
result = self.runner.invoke(
|
||||||
run, ["TOKEN"], env={"DOMAINS": "foobar.com foofoo.com"}
|
run, ["TOKEN"], env={"DOMAINS": "foobar.com foofoo.com"}
|
||||||
)
|
)
|
||||||
|
|
@ -341,8 +341,8 @@ class RunTestCase(TestCase):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
logger.output,
|
logger.output,
|
||||||
[
|
[
|
||||||
"INFO:ip_listener.main:Updated domain foobar.com",
|
"INFO:transip_client.main:Updated domain foobar.com",
|
||||||
"INFO:ip_listener.main:Updated domain foofoo.com",
|
"INFO:transip_client.main:Updated domain foofoo.com",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue