From 0e320d76824234632c682c30992130499943e914 Mon Sep 17 00:00:00 2001 From: Stas Shtin Date: Wed, 21 Apr 2010 20:21:16 +0400 Subject: [PATCH] Include test coverage to makefile. Update translations. --- Makefile | 6 +++- src/ipypbx/locale/ipypbx_fi.po | 60 ++++++++++++++++++++-------------------- src/ipypbx/locale/ipypbx_fi.ts | 60 ++++++++++++++++++++-------------------- src/ipypbx/locale/ipypbx_ru.po | 60 ++++++++++++++++++++-------------------- src/ipypbx/locale/ipypbx_ru.ts | 60 ++++++++++++++++++++-------------------- src/ipypbx/tests/__init__.py | 14 ++++++++++ src/ipypbx/tests/support.py | 11 ++------ src/ipypbx/tests/test_http.py | 17 ++++++++++++ src/ipypbx/ui.py | 2 +- 9 files changed, 159 insertions(+), 131 deletions(-) diff --git a/Makefile b/Makefile index 4abc8ad..20ea747 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ TRANSLATIONS_PATH=src/ipypbx/locale PROJECT=$(BASENAME).pro UI=ui/layout.ui -all: generate_sql generate_ui translation +all: generate_sql generate_ui translation coverage generate_ui: pyuic4 $(UI) -o src/$(BASENAME)/ui.py @@ -34,3 +34,7 @@ transrelease: generate_sql: PYTHONPATH=projects/sample/:src DJANGO_SETTINGS_MODULE=settings django-admin dumpsql + +coverage: + nosetests ipypbx.tests --with-coverage --cover-package=ipypbx + diff --git a/src/ipypbx/locale/ipypbx_fi.po b/src/ipypbx/locale/ipypbx_fi.po index 19a5540..7ca2c8e 100644 --- a/src/ipypbx/locale/ipypbx_fi.po +++ b/src/ipypbx/locale/ipypbx_fi.po @@ -16,25 +16,25 @@ msgid "IPyPBX" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 #, fuzzy msgid "Name" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:215 +#: src/ipypbx/controllers.py:208 #, fuzzy msgid "Local Port" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:215 +#: src/ipypbx/controllers.py:208 #, fuzzy msgid "Freeswitch Port" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:215 +#: src/ipypbx/controllers.py:208 #, fuzzy msgid "Freeswitch IP Address" msgstr "" @@ -58,49 +58,49 @@ msgid "Connections" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:324 +#: src/ipypbx/controllers.py:323 #, fuzzy msgid "External RTP IP" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:324 +#: src/ipypbx/controllers.py:323 #, fuzzy msgid "External SIP IP" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:324 +#: src/ipypbx/controllers.py:323 #, fuzzy msgid "RTP IP" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:324 +#: src/ipypbx/controllers.py:323 #, fuzzy msgid "SIP IP" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:324 +#: src/ipypbx/controllers.py:323 #, fuzzy msgid "SIP Port" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:324 +#: src/ipypbx/controllers.py:323 #, fuzzy msgid "Accept Blind Registration" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 #, fuzzy msgid "Authenticate Calls" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 #, fuzzy msgid "Is Active" msgstr "" @@ -112,7 +112,7 @@ msgid "SIP Profiles" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:343 +#: src/ipypbx/controllers.py:342 #, fuzzy msgid "Host Name" msgstr "" @@ -130,37 +130,37 @@ msgid "Domains" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 #, fuzzy msgid "Username" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:379 +#: src/ipypbx/controllers.py:378 #, fuzzy msgid "Password" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 #, fuzzy msgid "Realm" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 #, fuzzy msgid "From Domain" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 #, fuzzy msgid "Expire In Seconds" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 #, fuzzy msgid "Retry In Seconds" msgstr "" @@ -178,7 +178,7 @@ msgid "Gateways" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:379 +#: src/ipypbx/controllers.py:378 #, fuzzy msgid "User ID" msgstr "" @@ -196,13 +196,13 @@ msgid "Endpoints" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 #, fuzzy msgid "XML Dialplan" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 #, fuzzy msgid "Destination Match" msgstr "" @@ -214,49 +214,49 @@ msgid "Extensions" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 #, fuzzy msgid "ID" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:215 +#: src/ipypbx/controllers.py:208 #, fuzzy msgid "Local IP Address" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 #, fuzzy msgid "Connection ID" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 #, fuzzy msgid "SIP Profile ID" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 #, fuzzy msgid "Caller ID In From Field" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 #, fuzzy msgid "Domain ID" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 #, fuzzy msgid "Endpoint ID" msgstr "" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 #, fuzzy msgid "Extension" msgstr "" diff --git a/src/ipypbx/locale/ipypbx_fi.ts b/src/ipypbx/locale/ipypbx_fi.ts index 0d04b53..b5c5eeb 100644 --- a/src/ipypbx/locale/ipypbx_fi.ts +++ b/src/ipypbx/locale/ipypbx_fi.ts @@ -8,22 +8,22 @@ - + Name - + Local Port - + Freeswitch Port - + Freeswitch IP Address @@ -43,42 +43,42 @@ - + External RTP IP - + External SIP IP - + RTP IP - + SIP IP - + SIP Port - + Accept Blind Registration - + Authenticate Calls - + Is Active @@ -88,7 +88,7 @@ - + Host Name @@ -103,32 +103,32 @@ - + Username - + Password - + Realm - + From Domain - + Expire In Seconds - + Retry In Seconds @@ -143,7 +143,7 @@ - + User ID @@ -158,12 +158,12 @@ - + XML Dialplan - + Destination Match @@ -173,42 +173,42 @@ - + ID - + Local IP Address - + Connection ID - + SIP Profile ID - + Caller ID In From Field - + Domain ID - + Endpoint ID - + Extension diff --git a/src/ipypbx/locale/ipypbx_ru.po b/src/ipypbx/locale/ipypbx_ru.po index 835220e..96c3919 100644 --- a/src/ipypbx/locale/ipypbx_ru.po +++ b/src/ipypbx/locale/ipypbx_ru.po @@ -15,17 +15,17 @@ msgid "IPyPBX" msgstr "IPyPBX" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 msgid "Name" msgstr "Имя" #. ts-context MainWindow -#: src/ipypbx/controllers.py:215 +#: src/ipypbx/controllers.py:208 msgid "Local Port" msgstr "Локальный порт" #. ts-context MainWindow -#: src/ipypbx/controllers.py:215 +#: src/ipypbx/controllers.py:208 msgid "Freeswitch Port" msgstr "Порт Freeswitch" @@ -35,7 +35,7 @@ msgstr "Порт Freeswitch" #~ msgstr "Локальный IP-адрес" #. ts-context MainWindow -#: src/ipypbx/controllers.py:215 +#: src/ipypbx/controllers.py:208 msgid "Freeswitch IP Address" msgstr "IP-адрес Freeswitch" @@ -55,42 +55,42 @@ msgid "Connections" msgstr "Подключения" #. ts-context MainWindow -#: src/ipypbx/controllers.py:324 +#: src/ipypbx/controllers.py:323 msgid "External RTP IP" msgstr "Внешний RTP IP" #. ts-context MainWindow -#: src/ipypbx/controllers.py:324 +#: src/ipypbx/controllers.py:323 msgid "External SIP IP" msgstr "Внешний SIP IP" #. ts-context MainWindow -#: src/ipypbx/controllers.py:324 +#: src/ipypbx/controllers.py:323 msgid "RTP IP" msgstr "RTP IP" #. ts-context MainWindow -#: src/ipypbx/controllers.py:324 +#: src/ipypbx/controllers.py:323 msgid "SIP IP" msgstr "SIP IP" #. ts-context MainWindow -#: src/ipypbx/controllers.py:324 +#: src/ipypbx/controllers.py:323 msgid "SIP Port" msgstr "Порт SIP" #. ts-context MainWindow -#: src/ipypbx/controllers.py:324 +#: src/ipypbx/controllers.py:323 msgid "Accept Blind Registration" msgstr "Безусловная регистрация" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 msgid "Authenticate Calls" msgstr "Аутентифицировать звонки" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 msgid "Is Active" msgstr "Активен" @@ -100,7 +100,7 @@ msgid "SIP Profiles" msgstr "Профили SIP" #. ts-context MainWindow -#: src/ipypbx/controllers.py:343 +#: src/ipypbx/controllers.py:342 msgid "Host Name" msgstr "Имя хоста" @@ -115,32 +115,32 @@ msgid "Domains" msgstr "Домены" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 msgid "Username" msgstr "Имя пользователя" #. ts-context MainWindow -#: src/ipypbx/controllers.py:379 +#: src/ipypbx/controllers.py:378 msgid "Password" msgstr "Пароль" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 msgid "Realm" msgstr "Realm" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 msgid "From Domain" msgstr "Домен в поле \"From\"" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 msgid "Expire In Seconds" msgstr "Время регистрации в секундах" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 msgid "Retry In Seconds" msgstr "Время повтора в секундах" @@ -155,7 +155,7 @@ msgid "Gateways" msgstr "Сетевой шлюз" #. ts-context MainWindow -#: src/ipypbx/controllers.py:379 +#: src/ipypbx/controllers.py:378 msgid "User ID" msgstr "Идентификатор пользователя" @@ -170,12 +170,12 @@ msgid "Endpoints" msgstr "Конечное оборудование" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 msgid "XML Dialplan" msgstr "План нумерации XML" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 msgid "Destination Match" msgstr "Совпадение направления" @@ -190,42 +190,42 @@ msgid "Extensions" msgstr "Номера" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 msgid "ID" msgstr "Идентификатор" #. ts-context MainWindow -#: src/ipypbx/controllers.py:215 +#: src/ipypbx/controllers.py:208 msgid "Local IP Address" msgstr "Локальный IP-адрес" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 msgid "Connection ID" msgstr "Идентификатор соединения" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 msgid "SIP Profile ID" msgstr "Идентификатор SIP-профиля" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 msgid "Caller ID In From Field" msgstr "Идентификатор вызывающего абонента в поле \"От\"" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 msgid "Domain ID" msgstr "Идентификатор домена" #. ts-context MainWindow -#: src/ipypbx/controllers.py:394 +#: src/ipypbx/controllers.py:393 msgid "Endpoint ID" msgstr "Идентификатор конечного оборудования" #. ts-context MainWindow -#: src/ipypbx/controllers.py:357 +#: src/ipypbx/controllers.py:356 #, fuzzy msgid "Extension" msgstr "" diff --git a/src/ipypbx/locale/ipypbx_ru.ts b/src/ipypbx/locale/ipypbx_ru.ts index 53d9bf2..9d9bd4a 100644 --- a/src/ipypbx/locale/ipypbx_ru.ts +++ b/src/ipypbx/locale/ipypbx_ru.ts @@ -8,17 +8,17 @@ IPyPBX - + Name Имя - + Local Port Локальный порт - + Freeswitch Port Порт Freeswitch @@ -28,7 +28,7 @@ Локальный IP-адрес - + Freeswitch IP Address IP-адрес Freeswitch @@ -48,42 +48,42 @@ Подключения - + External RTP IP Внешний RTP IP - + External SIP IP Внешний SIP IP - + RTP IP RTP IP - + SIP IP SIP IP - + SIP Port Порт SIP - + Accept Blind Registration Безусловная регистрация - + Authenticate Calls Аутентифицировать звонки - + Is Active Активен @@ -93,7 +93,7 @@ Профили SIP - + Host Name Имя хоста @@ -108,32 +108,32 @@ Домены - + Username Имя пользователя - + Password Пароль - + Realm Realm - + From Domain Домен в поле "From" - + Expire In Seconds Время регистрации в секундах - + Retry In Seconds Время повтора в секундах @@ -148,7 +148,7 @@ Сетевой шлюз - + User ID Идентификатор пользователя @@ -163,12 +163,12 @@ Конечное оборудование - + XML Dialplan План нумерации XML - + Destination Match Совпадение направления @@ -183,42 +183,42 @@ Номера - + ID Идентификатор - + Local IP Address Локальный IP-адрес - + Connection ID Идентификатор соединения - + SIP Profile ID Идентификатор SIP-профиля - + Caller ID In From Field Идентификатор вызывающего абонента в поле "От" - + Domain ID Идентификатор домена - + Endpoint ID Идентификатор конечного оборудования - + Extension diff --git a/src/ipypbx/tests/__init__.py b/src/ipypbx/tests/__init__.py index ac26041..7920144 100644 --- a/src/ipypbx/tests/__init__.py +++ b/src/ipypbx/tests/__init__.py @@ -15,4 +15,18 @@ # You should have received a copy of the GNU General Public License # along with IPyPBX. If not, see . +from ipypbx import main + +_tables = ( + 'connection', 'sipprofile', 'domain', 'gateway', 'endpoint', + 'extension') + +db = None + +from ipypbx.tests.test_http import * + + +def setUp(): + global db + db, _created = main.setupDb(dbname=':memory:') diff --git a/src/ipypbx/tests/support.py b/src/ipypbx/tests/support.py index 8cde219..bfc8405 100644 --- a/src/ipypbx/tests/support.py +++ b/src/ipypbx/tests/support.py @@ -16,17 +16,10 @@ # along with IPyPBX. If not, see . from ipypbx import main +from ipypbx.tests import db class InitDatabase(object): - _tables = ( - 'connection', 'sipprofile', 'domain', 'gateway', 'endpoint', - 'extension') - - @classmethod - def setUpClass(cls): - cls.db, _created = main.setupDb(dbname=':memory:') - def setUp(self): for table in self._tables: - self.db.exec_('delete from ipypbxweb_%s' % table) + db.exec_('delete from ipypbxweb_%s' % table) diff --git a/src/ipypbx/tests/test_http.py b/src/ipypbx/tests/test_http.py index 7434635..45f3d87 100644 --- a/src/ipypbx/tests/test_http.py +++ b/src/ipypbx/tests/test_http.py @@ -20,6 +20,10 @@ from ipypbx import http from ipypbx.tests import support from xml.etree import ElementTree as etree +__all__ = ( + 'TestHttpRequestParser', 'TestFreeswitchConfigGenerator', + 'TestSofiaConfGenerator') + class TestHttpRequestParser(unittest.TestCase): """ @@ -156,6 +160,10 @@ class TestFreeswitchConfigGenerator(unittest.TestCase): self.generator.canHandle({'foo': 'bar', 'qwe': 'asd'}), False) def test_base_elements(self): + """ + ipypbx.http.FreeswitchConfigGenerator.baseElements returns a tuple of + document and section elelements. + """ self.generator.param_match = {'section': 'foo'} root_elt, section_elt = self.generator.baseElements self.assertEqual( @@ -166,6 +174,10 @@ class TestFreeswitchConfigGenerator(unittest.TestCase): etree.tostring(section_elt), '
') def test_add_params(self): + """ + ipypbx.http.FreeswitchConfigGenerator.addParams is a helper method for + creating params element. + """ foo_elt = etree.Element('foo') self.assertEqual( etree.tostring(self.generator.addParams(foo_elt, (('qwe', 'asd'),))), @@ -179,3 +191,8 @@ class TestFreeswitchConfigGenerator(unittest.TestCase): (('qwe', 'asd'), ('zxc', '123')))), '' '') + + +class TestSofiaConfGenerator(unittest.TestCase): + def test_generate_config(self): + pass diff --git a/src/ipypbx/ui.py b/src/ipypbx/ui.py index d31b150..44efad4 100644 --- a/src/ipypbx/ui.py +++ b/src/ipypbx/ui.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'ui/layout.ui' # -# Created: Thu Apr 15 21:54:09 2010 +# Created: Wed Apr 21 19:42:15 2010 # by: PyQt4 UI code generator 4.7.2 # # WARNING! All changes made in this file will be lost! -- 1.7.9.5