Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Trevor Cappallo
OperationalLogging
Commits
935048b1
Commit
935048b1
authored
Sep 01, 2015
by
Trevor Cappallo
Browse files
add unit tests
parent
2e66e5b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
0 deletions
+55
-0
lib/TestCritical.py
lib/TestCritical.py
+29
-0
lib/TestUnicode.py
lib/TestUnicode.py
+26
-0
No files found.
lib/TestCritical.py
0 → 100644
View file @
935048b1
#!/usr/bin/env python
"""Unit tests for OperationalLogging."""
import
unittest
from
nose.tools
import
raises
,
eq_
import
logging
import
OperationalLogger
as
OpLog
class
TestCritical
(
unittest
.
TestCase
):
def
setUp
(
self
):
OpLog
.
setup
(
notify
=
{
'DEBUG'
:
'tcappallo@veriskclimate.com'
})
def
tearDown
(
self
):
pass
def
test_debug
(
self
):
logging
.
getLogger
().
debug
(
"This is a debug statement."
)
def
test_error
(
self
):
logging
.
getLogger
().
error
(
"This is an error statement."
)
def
test_critical
(
self
):
logging
.
getLogger
().
critical
(
"This is a critical statement."
)
if
__name__
==
'__main__'
:
unittest
.
main
()
lib/TestUnicode.py
0 → 100644
View file @
935048b1
#!/usr/bin/env python
"""Unit tests for OperationalLogging."""
import
unittest
from
nose.tools
import
raises
,
eq_
import
logging
import
OperationalLogger
as
OpLog
class
TestCritical
(
unittest
.
TestCase
):
def
setUp
(
self
):
OpLog
.
setup
(
notify
=
{
'ERROR'
:
'tcappallo@veriskclimate.com'
})
def
tearDown
(
self
):
pass
def
test_unicode
(
self
):
logging
.
getLogger
(
__name__
).
info
(
"This has a __name__."
)
logging
.
getLogger
().
info
(
"This has no __name__."
)
logging
.
getLogger
(
__name__
).
info
(
"This has a unicode string here -->%s<--"
,
u
"
\xe2\xe3
"
)
logging
.
getLogger
(
__name__
).
info
(
u
"This has a unicode character here -->
\xe2\xe3
<--"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment