Commit 24855ebb authored by Romain Courteaud's avatar Romain Courteaud

Rename

parent dcdb21ef
# Url checker
# surykatka
......@@ -21,21 +21,21 @@
from setuptools import setup
setup(
name="urlchecker",
name="surykatka",
version="0.0.1",
license="GPLv3+",
author="Nexedi",
author_email="romain@nexedi.com",
long_description=__doc__,
py_modules=[
"urlchecker_bot",
"urlchecker_cli",
"urlchecker_configuration",
"urlchecker_dns",
"urlchecker_http",
"urlchecker_network",
"urlchecker_platform",
"urlchecker_status",
"surykatka_bot",
"surykatka_cli",
"surykatka_configuration",
"surykatka_dns",
"surykatka_http",
"surykatka_network",
"surykatka_platform",
"surykatka_status",
],
include_package_data=False,
zip_safe=True,
......@@ -52,6 +52,6 @@ setup(
"dev": ["pytest", "black", "pyflakes", "mock", "httpretty"]
},
entry_points={
"console_scripts": ["urlchecker=urlchecker_cli:runUrlChecker "]
"console_scripts": ["surykatka=surykatka_cli:runSurykatka "]
},
)
......@@ -18,22 +18,22 @@
# See https://www.nexedi.com/licensing for rationale and options.
import time
from urlchecker_db import LogDB
from urlchecker_configuration import createConfiguration, logConfiguration
from urlchecker_status import logStatus, reportStatus
from urlchecker_dns import (
from surykatka_db import LogDB
from surykatka_configuration import createConfiguration, logConfiguration
from surykatka_status import logStatus, reportStatus
from surykatka_dns import (
getReachableResolverList,
expandDomainList,
getDomainIpDict,
reportDnsQuery,
)
from urlchecker_http import (
from surykatka_http import (
getRootUrl,
getUrlHostname,
checkHttpStatus,
reportHttp,
)
from urlchecker_network import isTcpPortOpen, reportNetwork
from surykatka_network import isTcpPortOpen, reportNetwork
import json
import email.utils
from collections import OrderedDict
......
......@@ -19,10 +19,10 @@
import click
import sys
from urlchecker_bot import create_bot
from surykatka_bot import create_bot
@click.command(short_help="Runs url checker bot.")
@click.command(short_help="Runs surykatka bot.")
@click.option(
"--run",
"-r",
......@@ -55,7 +55,7 @@ from urlchecker_bot import create_bot
default="plain",
show_default=True,
)
def runUrlChecker(
def runSurykatka(
run,
sqlite,
nameserver,
......@@ -67,7 +67,6 @@ def runUrlChecker(
output,
):
# click.echo("Running url checker bot")
mapping = {}
if url:
mapping["URL"] = url
......@@ -88,4 +87,4 @@ def runUrlChecker(
if __name__ == "__main__":
sys.exit(runUrlChecker())
sys.exit(runSurykatka())
......@@ -22,11 +22,11 @@ import os
from dns.resolver import get_default_resolver
CONFIG_SECTION = "URLCHECKER"
CONFIG_SECTION = "SURYKATKA"
def createConfiguration(
envvar="URLCHECKER_SETTINGS", cfgfile=None, mapping=None
envvar="SURYKATKA_SETTINGS", cfgfile=None, mapping=None
):
config = configparser.ConfigParser(empty_lines_in_values=False)
# Default values
......
......@@ -56,6 +56,10 @@ class LogDB:
class Meta:
primary_key = peewee.CompositeKey("status", "parameter")
# indexes = (
# create a unique on from/to/date
# (('status', 'parameter'), True),
# )
# Store the configuration modification
class PlatformChange(BaseModel):
......
......@@ -18,7 +18,7 @@
# See https://www.nexedi.com/licensing for rationale and options.
import dns
from urlchecker_network import logNetwork
from surykatka_network import logNetwork
from peewee import fn
URL_TO_CHECK = "example.org"
......
......@@ -38,9 +38,9 @@ def getRootUrl(url):
def getUserAgent(version):
return "%s/%s (+%s)" % (
"URLCHECKER",
"SURYKATKA",
version,
"https://lab.nexedi.com/romain/url-checker",
"https://lab.nexedi.com/nexedi/surykatka",
)
......
......@@ -18,10 +18,10 @@
# See https://www.nexedi.com/licensing for rationale and options.
import unittest
from urlchecker_bot import WebBot
from surykatka_bot import WebBot
import mock
from test_urlchecker_dns import MockAnswer
import urlchecker_dns
from test_surykatka_dns import MockAnswer
import surykatka_dns
def checkNetworkChange(bot, result_list):
......@@ -54,17 +54,17 @@ def checkDnsChange(bot, result_list):
assert [(x.resolver_ip, x.domain) for x in select_list] == result_list
class UrlCheckerBotTestCase(unittest.TestCase):
class SurykatkaBotTestCase(unittest.TestCase):
def test_emptyConfiguration(self):
resolver_ip = "192.168.0.254"
resolver = urlchecker_dns.dns.resolver.Resolver(configure=False)
resolver = surykatka_dns.dns.resolver.Resolver(configure=False)
resolver.nameservers.append(resolver_ip)
with mock.patch(
"urlchecker_configuration.get_default_resolver"
"surykatka_configuration.get_default_resolver"
) as mock_get_default_resolver, mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query:
mock_get_default_resolver.return_value = resolver
......@@ -87,17 +87,17 @@ class UrlCheckerBotTestCase(unittest.TestCase):
def test_oneNameserverOneDomainOneIp(self):
resolver_ip = "127.0.0.1"
resolver = urlchecker_dns.dns.resolver.Resolver(configure=False)
resolver = surykatka_dns.dns.resolver.Resolver(configure=False)
resolver.nameservers.append(resolver_ip)
with mock.patch(
"urlchecker_configuration.get_default_resolver"
"surykatka_configuration.get_default_resolver"
) as mock_get_default_resolver, mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query, mock.patch(
"urlchecker_network.socket.socket"
"surykatka_network.socket.socket"
) as mock_socket, mock.patch(
"urlchecker_http.request"
"surykatka_http.request"
) as mock_request:
mock_get_default_resolver.return_value = resolver
......@@ -142,11 +142,11 @@ class UrlCheckerBotTestCase(unittest.TestCase):
bot.initDB()
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query, mock.patch(
"urlchecker_network.socket.socket"
"surykatka_network.socket.socket"
) as mock_socket, mock.patch(
"urlchecker_http.request"
"surykatka_http.request"
) as mock_request:
mock_query.return_value = [MockAnswer("1.2.3.4")]
......@@ -194,11 +194,11 @@ class UrlCheckerBotTestCase(unittest.TestCase):
bot.initDB()
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query, mock.patch(
"urlchecker_network.socket.socket"
"surykatka_network.socket.socket"
) as mock_socket, mock.patch(
"urlchecker_http.request"
"surykatka_http.request"
) as mock_request:
mock_query.return_value = [MockAnswer("1.2.3.4")]
......@@ -239,11 +239,11 @@ class UrlCheckerBotTestCase(unittest.TestCase):
bot.initDB()
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query, mock.patch(
"urlchecker_network.socket.socket"
"surykatka_network.socket.socket"
) as mock_socket, mock.patch(
"urlchecker_http.request"
"surykatka_http.request"
) as mock_request:
mock_query.return_value = [
......@@ -295,11 +295,11 @@ class UrlCheckerBotTestCase(unittest.TestCase):
bot.initDB()
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query, mock.patch(
"urlchecker_network.socket.socket"
"surykatka_network.socket.socket"
) as mock_socket, mock.patch(
"urlchecker_http.request"
"surykatka_http.request"
) as mock_request:
mock_query.return_value = [MockAnswer("1.2.3.4")]
......@@ -340,11 +340,11 @@ class UrlCheckerBotTestCase(unittest.TestCase):
bot.initDB()
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query, mock.patch(
"urlchecker_network.socket.socket"
"surykatka_network.socket.socket"
) as mock_socket, mock.patch(
"urlchecker_http.request"
"surykatka_http.request"
) as mock_request:
mock_query.return_value = [MockAnswer("1.2.3.4")]
......@@ -383,11 +383,11 @@ class UrlCheckerBotTestCase(unittest.TestCase):
bot.initDB()
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query, mock.patch(
"urlchecker_network.socket.socket"
"surykatka_network.socket.socket"
) as mock_socket, mock.patch(
"urlchecker_http.request"
"surykatka_http.request"
) as mock_request:
mock_query.side_effect = [[MockAnswer("1.2.3.4")], []]
......@@ -408,7 +408,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(UrlCheckerBotTestCase))
suite.addTest(unittest.makeSuite(SurykatkaBotTestCase))
return suite
......
......@@ -18,10 +18,10 @@
# See https://www.nexedi.com/licensing for rationale and options.
import unittest
from urlchecker_db import LogDB
from surykatka_db import LogDB
class UrlCheckerDBTestCase(unittest.TestCase):
class SurykatkaDBTestCase(unittest.TestCase):
def setUp(self):
self.db = LogDB(":memory:")
......@@ -33,7 +33,7 @@ class UrlCheckerDBTestCase(unittest.TestCase):
def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(UrlCheckerDBTestCase))
suite.addTest(unittest.makeSuite(SurykatkaDBTestCase))
return suite
......
......@@ -18,10 +18,10 @@
# See https://www.nexedi.com/licensing for rationale and options.
import unittest
from urlchecker_db import LogDB
from surykatka_db import LogDB
import peewee
import urlchecker_dns
from urlchecker_dns import (
import surykatka_dns
from surykatka_dns import (
expandDomainList,
logDnsQuery,
buildResolver,
......@@ -29,7 +29,7 @@ from urlchecker_dns import (
getReachableResolverList,
getDomainIpDict,
)
from urlchecker_status import logStatus
from surykatka_status import logStatus
import mock
......@@ -38,7 +38,7 @@ class MockAnswer(object):
self.address = address
class UrlCheckerDNSTestCase(unittest.TestCase):
class SurykatkaDNSTestCase(unittest.TestCase):
def setUp(self):
self.db = LogDB(":memory:")
self.db.createTables()
......@@ -245,7 +245,7 @@ class UrlCheckerDNSTestCase(unittest.TestCase):
status_id = logStatus(self.db, "foo")
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query:
mock_query.return_value = [
MockAnswer("4.3.2.1"),
......@@ -286,11 +286,11 @@ class UrlCheckerDNSTestCase(unittest.TestCase):
status_id = logStatus(self.db, "foo")
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query:
def sideEffect(*args, **kw):
raise urlchecker_dns.dns.resolver.NXDOMAIN()
raise surykatka_dns.dns.resolver.NXDOMAIN()
mock_query.side_effect = sideEffect
result = queryDNS(self.db, status_id, resolver_ip, domain, rdtype)
......@@ -315,11 +315,11 @@ class UrlCheckerDNSTestCase(unittest.TestCase):
status_id = logStatus(self.db, "foo")
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query:
def sideEffect(*args, **kw):
raise urlchecker_dns.dns.resolver.NoAnswer()
raise surykatka_dns.dns.resolver.NoAnswer()
mock_query.side_effect = sideEffect
result = queryDNS(self.db, status_id, resolver_ip, domain, rdtype)
......@@ -344,11 +344,11 @@ class UrlCheckerDNSTestCase(unittest.TestCase):
status_id = logStatus(self.db, "foo")
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query:
def sideEffect(*args, **kw):
raise urlchecker_dns.dns.exception.Timeout()
raise surykatka_dns.dns.exception.Timeout()
mock_query.side_effect = sideEffect
result = queryDNS(self.db, status_id, resolver_ip, domain, rdtype)
......@@ -373,11 +373,11 @@ class UrlCheckerDNSTestCase(unittest.TestCase):
status_id = logStatus(self.db, "foo")
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query:
def sideEffect(*args, **kw):
raise urlchecker_dns.dns.resolver.NoNameservers()
raise surykatka_dns.dns.resolver.NoNameservers()
mock_query.side_effect = sideEffect
result = queryDNS(self.db, status_id, resolver_ip, domain, rdtype)
......@@ -405,7 +405,7 @@ class UrlCheckerDNSTestCase(unittest.TestCase):
status_id = logStatus(self.db, "foo")
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query:
mock_query.return_value = [
MockAnswer("4.3.2.1"),
......@@ -442,11 +442,11 @@ class UrlCheckerDNSTestCase(unittest.TestCase):
status_id = logStatus(self.db, "foo")
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query:
def sideEffect(*args, **kw):
raise urlchecker_dns.dns.exception.Timeout()
raise surykatka_dns.dns.exception.Timeout()
mock_query.side_effect = sideEffect
......@@ -484,7 +484,7 @@ class UrlCheckerDNSTestCase(unittest.TestCase):
status_id = logStatus(self.db, "foo")
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query:
mock_query.return_value = [
MockAnswer("4.3.2.1"),
......@@ -513,7 +513,7 @@ class UrlCheckerDNSTestCase(unittest.TestCase):
status_id = logStatus(self.db, "foo")
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query:
mock_query.side_effect = [
[MockAnswer("4.3.2.1"), MockAnswer("1.2.3.4")],
......@@ -546,7 +546,7 @@ class UrlCheckerDNSTestCase(unittest.TestCase):
status_id = logStatus(self.db, "foo")
with mock.patch(
"urlchecker_dns.dns.resolver.Resolver.query"
"surykatka_dns.dns.resolver.Resolver.query"
) as mock_query:
mock_query.side_effect = [
[MockAnswer("4.3.2.1"), MockAnswer("1.2.3.4")],
......@@ -575,7 +575,7 @@ class UrlCheckerDNSTestCase(unittest.TestCase):
def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(UrlCheckerDNSTestCase))
suite.addTest(unittest.makeSuite(SurykatkaDNSTestCase))
return suite
......
......@@ -18,9 +18,9 @@
# See https://www.nexedi.com/licensing for rationale and options.
import unittest
from urlchecker_db import LogDB
import urlchecker_http
from urlchecker_http import (
from surykatka_db import LogDB
import surykatka_http
from surykatka_http import (
getUrlHostname,
getRootUrl,
getUserAgent,
......@@ -28,13 +28,13 @@ from urlchecker_http import (
logHttpStatus,
checkHttpStatus,
)
from urlchecker_status import logStatus
from surykatka_status import logStatus
import httpretty
import mock
import peewee
class UrlCheckerHttpTestCase(unittest.TestCase):
class SurykatkaHttpTestCase(unittest.TestCase):
def setUp(self):
self.db = LogDB(":memory:")
self.db.createTables()
......@@ -60,7 +60,7 @@ class UrlCheckerHttpTestCase(unittest.TestCase):
result = getUserAgent("0.0.3")
assert (
result
== "URLCHECKER/0.0.3 (+https://lab.nexedi.com/romain/url-checker)"
== "SURYKATKA/0.0.3 (+https://lab.nexedi.com/nexedi/surykatka)"
)
################################################
......@@ -68,7 +68,7 @@ class UrlCheckerHttpTestCase(unittest.TestCase):
################################################
def test_request_arguments(self):
url_to_proxy = "http://example.org/"
with mock.patch("urlchecker_http.requests.request") as mock_request:
with mock.patch("surykatka_http.requests.request") as mock_request:
request(url_to_proxy)
assert mock_request.call_count == 1
mock_request.assert_called_with(
......@@ -77,7 +77,7 @@ class UrlCheckerHttpTestCase(unittest.TestCase):
allow_redirects=False,
headers={
"Accept": "text/html;q=0.9,*/*;q=0.8",
"User-Agent": "URLCHECKER/0 (+https://lab.nexedi.com/romain/url-checker)",
"User-Agent": "SURYKATKA/0 (+https://lab.nexedi.com/nexedi/surykatka)",
},
stream=False,
timeout=2,
......@@ -98,7 +98,7 @@ class UrlCheckerHttpTestCase(unittest.TestCase):
assert last_request.headers["Host"] == "example.org"
assert (
last_request.headers["User-Agent"]
== "URLCHECKER/0 (+https://lab.nexedi.com/romain/url-checker)"
== "SURYKATKA/0 (+https://lab.nexedi.com/nexedi/surykatka)"
)
assert len(last_request.body) == 0
assert response.status_code == 418
......@@ -128,10 +128,10 @@ class UrlCheckerHttpTestCase(unittest.TestCase):
def test_request_connectionError(self):
url_to_proxy = "http://example.org/"
httpretty.register_uri(httpretty.GET, url_to_proxy)
with mock.patch("urlchecker_http.requests.request") as mock_request:
with mock.patch("surykatka_http.requests.request") as mock_request:
def sideEffect(*args, **kw):
raise urlchecker_http.requests.exceptions.ConnectionError()
raise surykatka_http.requests.exceptions.ConnectionError()
mock_request.side_effect = sideEffect
response = request(url_to_proxy)
......@@ -141,10 +141,10 @@ class UrlCheckerHttpTestCase(unittest.TestCase):
def test_request_timeout(self):
url_to_proxy = "http://example.org/"
httpretty.register_uri(httpretty.GET, url_to_proxy)
with mock.patch("urlchecker_http.requests.request") as mock_request:
with mock.patch("surykatka_http.requests.request") as mock_request:
def sideEffect(*args, **kw):
raise urlchecker_http.requests.exceptions.Timeout()
raise surykatka_http.requests.exceptions.Timeout()
mock_request.side_effect = sideEffect
response = request(url_to_proxy)
......@@ -154,10 +154,10 @@ class UrlCheckerHttpTestCase(unittest.TestCase):
def test_request_tooManyRedirect(self):
url_to_proxy = "http://example.org/"
httpretty.register_uri(httpretty.GET, url_to_proxy)
with mock.patch("urlchecker_http.requests.request") as mock_request:
with mock.patch("surykatka_http.requests.request") as mock_request:
def sideEffect(*args, **kw):
raise urlchecker_http.requests.exceptions.TooManyRedirects()
raise surykatka_http.requests.exceptions.TooManyRedirects()
mock_request.side_effect = sideEffect
response = request(url_to_proxy)
......@@ -167,10 +167,10 @@ class UrlCheckerHttpTestCase(unittest.TestCase):
def test_request_sslError(self):
url_to_proxy = "http://example.org/"
httpretty.register_uri(httpretty.GET, url_to_proxy)
with mock.patch("urlchecker_http.requests.request") as mock_request:
with mock.patch("surykatka_http.requests.request") as mock_request:
def sideEffect(*args, **kw):
raise urlchecker_http.requests.exceptions.SSLError()
raise surykatka_http.requests.exceptions.SSLError()
mock_request.side_effect = sideEffect
response = request(url_to_proxy)
......@@ -306,7 +306,7 @@ class UrlCheckerHttpTestCase(unittest.TestCase):
assert last_request.headers["Host"] == "example.org"
assert (
last_request.headers["User-Agent"]
== "URLCHECKER/1 (+https://lab.nexedi.com/romain/url-checker)"
== "SURYKATKA/1 (+https://lab.nexedi.com/nexedi/surykatka)"
)
assert len(last_request.body) == 0
......@@ -322,7 +322,7 @@ class UrlCheckerHttpTestCase(unittest.TestCase):
bot_version = 2
status_id = logStatus(self.db, "foo")
with mock.patch("urlchecker_http.request") as mock_request:
with mock.patch("surykatka_http.request") as mock_request:
checkHttpStatus(self.db, status_id, url, ip, bot_version)
assert mock_request.call_count == 1
......@@ -362,7 +362,7 @@ class UrlCheckerHttpTestCase(unittest.TestCase):
def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(UrlCheckerHttpTestCase))
suite.addTest(unittest.makeSuite(SurykatkaHttpTestCase))
return suite
......
......@@ -18,15 +18,15 @@
# See https://www.nexedi.com/licensing for rationale and options.
import unittest
from urlchecker_db import LogDB
import urlchecker_network
from urlchecker_network import logNetwork, isTcpPortOpen
from urlchecker_status import logStatus
from surykatka_db import LogDB
import surykatka_network
from surykatka_network import logNetwork, isTcpPortOpen
from surykatka_status import logStatus
import mock
import peewee
class UrlCheckerNetworkTestCase(unittest.TestCase):
class SurykatkaNetworkTestCase(unittest.TestCase):
def setUp(self):
self.db = LogDB(":memory:")
self.db.createTables()
......@@ -189,7 +189,7 @@ class UrlCheckerNetworkTestCase(unittest.TestCase):
port = 1234
status_id = logStatus(self.db, "foo")
with mock.patch("urlchecker_network.socket.socket") as mock_socket:
with mock.patch("surykatka_network.socket.socket") as mock_socket:
result = isTcpPortOpen(self.db, ip, port, status_id)
assert mock_socket.call_count == 1
......@@ -214,7 +214,7 @@ class UrlCheckerNetworkTestCase(unittest.TestCase):
port = 1234
status_id = logStatus(self.db, "foo")
with mock.patch("urlchecker_network.socket.socket") as mock_socket:
with mock.patch("surykatka_network.socket.socket") as mock_socket:
def sideEffect(*args, **kw):
raise ConnectionRefusedError()
......@@ -245,10 +245,10 @@ class UrlCheckerNetworkTestCase(unittest.TestCase):
port = 1234
status_id = logStatus(self.db, "foo")
with mock.patch("urlchecker_network.socket.socket") as mock_socket:
with mock.patch("surykatka_network.socket.socket") as mock_socket:
def sideEffect(*args, **kw):
raise urlchecker_network.socket.timeout()
raise surykatka_network.socket.timeout()
mock_socket.return_value.connect.side_effect = sideEffect
......@@ -276,10 +276,10 @@ class UrlCheckerNetworkTestCase(unittest.TestCase):
port = 1234
status_id = logStatus(self.db, "foo")
with mock.patch("urlchecker_network.socket.socket") as mock_socket:
with mock.patch("surykatka_network.socket.socket") as mock_socket:
def sideEffect(*args, **kw):
raise OSError(urlchecker_network.errno.EHOSTUNREACH, "foo")
raise OSError(surykatka_network.errno.EHOSTUNREACH, "foo")
mock_socket.return_value.connect.side_effect = sideEffect
......@@ -307,10 +307,10 @@ class UrlCheckerNetworkTestCase(unittest.TestCase):
port = 1234
status_id = logStatus(self.db, "foo")
with mock.patch("urlchecker_network.socket.socket") as mock_socket:
with mock.patch("surykatka_network.socket.socket") as mock_socket:
def sideEffect(*args, **kw):
raise OSError(urlchecker_network.errno.ENETUNREACH, "foo")
raise OSError(surykatka_network.errno.ENETUNREACH, "foo")
mock_socket.return_value.connect.side_effect = sideEffect
......@@ -338,7 +338,7 @@ class UrlCheckerNetworkTestCase(unittest.TestCase):
port = 1234
status_id = logStatus(self.db, "foo")
with mock.patch("urlchecker_network.socket.socket") as mock_socket:
with mock.patch("surykatka_network.socket.socket") as mock_socket:
def sideEffect(*args, **kw):
raise OSError()
......@@ -367,7 +367,7 @@ class UrlCheckerNetworkTestCase(unittest.TestCase):
port = 1234
status_id = logStatus(self.db, "foo")
with mock.patch("urlchecker_network.socket.socket") as mock_socket:
with mock.patch("surykatka_network.socket.socket") as mock_socket:
def sideEffect(*args, **kw):
raise Exception()
......@@ -394,7 +394,7 @@ class UrlCheckerNetworkTestCase(unittest.TestCase):
def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(UrlCheckerNetworkTestCase))
suite.addTest(unittest.makeSuite(SurykatkaNetworkTestCase))
return suite
......
......@@ -18,11 +18,11 @@
# See https://www.nexedi.com/licensing for rationale and options.
import unittest
from urlchecker_db import LogDB
from urlchecker_status import logStatus
from surykatka_db import LogDB
from surykatka_status import logStatus
class UrlCheckerStatusTestCase(unittest.TestCase):
class SurykatkaStatusTestCase(unittest.TestCase):
def setUp(self):
self.db = LogDB(":memory:")
self.db.createTables()
......@@ -45,7 +45,7 @@ class UrlCheckerStatusTestCase(unittest.TestCase):
def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(UrlCheckerStatusTestCase))
suite.addTest(unittest.makeSuite(SurykatkaStatusTestCase))
return suite
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment