Skip to content

Commit

Permalink
[UPDATE] Coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav WEB committed Feb 10, 2017
1 parent 272b36a commit 7fe231f
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ opendoor.egg-info/
/reports/
/data/directories.dat.back
/.coverage
/tests/tmp/
11 changes: 11 additions & 0 deletions tests/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from __future__ import absolute_import
import unittest2 as unittest
from src.lib.package.config import Config
from src.lib.events import EventHandler
from src import Controller, SrcError


Expand All @@ -32,6 +33,14 @@ def test_init_exception(self):
Controller().scan_action({})
self.assertTrue(SrcError == context.expected)

def test_run_exception(self):
""" Controller.run() exception test """

controller = Controller.__new__(Controller)
with self.assertRaises(SrcError) as context:
controller.run()
self.assertTrue(SrcError == context.expected)

def test_scan_action_exception(self):
""" Controller.scan_action() exception test """

Expand All @@ -46,12 +55,14 @@ def test_scan_action_exception(self):
def test_examples_action(self):
""" Controller.examples_action() test """

Config.params['cfg'] = 'setup.cfg'
controller = Controller.__new__(Controller)
self.assertIsNone(controller.examples_action())

def test_update_action(self):
""" Controller.update_action() test """

Config.params['cfg'] = 'setup.cfg'
controller = Controller.__new__(Controller)
self.assertIsNone(controller.update_action())

Expand Down
42 changes: 42 additions & 0 deletions tests/test_lib_events.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-

"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Development Team: Stanislav WEB
"""

from __future__ import absolute_import
import unittest2 as unittest
import os
import sys
import signal
from src.lib.events import EventHandler

@unittest.skipUnless(hasattr(os, 'kill'), "Test requires os.kill")
@unittest.skipIf(sys.platform =="win32", "Test cannot run on Windows")
@unittest.skipIf(sys.platform == 'freebsd6', "Test kills regrtest on freebsd6 "
"if threads have been used")
class TestEvents(unittest.TestCase):
"""TestEvents class"""

def test_termination_handler(self):
""" Events.terminate() exception test """

EventHandler.terminate()

self.assertIs('kill_process', signal.getsignal(signal.SIGTSTP).__name__)
self.assertTrue(None is not signal.getsignal(signal.SIGTERM))

if __name__ == "__main__":
unittest.main()
16 changes: 8 additions & 8 deletions tests/tmp/list.tmp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
admin/account.asp
admin/admin/login/
admin/admin/
admin/account.php
admin/account.html
admin/adminLogin.htm
admin/admin-login.php
admin/account.asp
admin/admin-login/
admin/admin.shtml
admin/access_log
admin/admin-login.html
admin/account.php
admin/access.php
admin/access.txt
admin/admin-login.php
admin/access_log
admin/admin.shtml
admin/access.php
admin/admin.html
admin/admin.php
admin/adminLogin.htm
admin/admin/

0 comments on commit 7fe231f

Please sign in to comment.