Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envsetup
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mediaserver
envsetup
Commits
e014fcfc
Commit
e014fcfc
authored
8 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
PEP8.
parent
2c5ad201
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_mail.py
+8
-0
8 additions, 0 deletions
tests/test_mail.py
with
8 additions
and
0 deletions
tests/test_mail.py
+
8
−
0
View file @
e014fcfc
...
@@ -20,22 +20,28 @@ if not os.path.isfile('../utils.py'):
...
@@ -20,22 +20,28 @@ if not os.path.isfile('../utils.py'):
print
(
'
conf.sh not found
'
)
print
(
'
conf.sh not found
'
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
def
print_color
(
txt
,
col
):
def
print_color
(
txt
,
col
):
print
(
'
%s%s%s
'
%
(
col
,
txt
,
DEF
))
print
(
'
%s%s%s
'
%
(
col
,
txt
,
DEF
))
def
print_red
(
txt
):
def
print_red
(
txt
):
print_color
(
txt
,
RED
)
print_color
(
txt
,
RED
)
def
print_green
(
txt
):
def
print_green
(
txt
):
print_color
(
txt
,
GREEN
)
print_color
(
txt
,
GREEN
)
all_ok
=
True
all_ok
=
True
def
get_configured_relay
():
def
get_configured_relay
():
status
,
out
=
subprocess
.
getstatusoutput
(
'
grep relayhost /etc/postfix/main.cf
'
)
status
,
out
=
subprocess
.
getstatusoutput
(
'
grep relayhost /etc/postfix/main.cf
'
)
if
status
==
0
:
if
status
==
0
:
return
out
.
split
(
'
relayhost =
'
)[
1
]
return
out
.
split
(
'
relayhost =
'
)[
1
]
def
check_relay
():
def
check_relay
():
global
all_ok
global
all_ok
global
conf
global
conf
...
@@ -50,6 +56,7 @@ def check_relay():
...
@@ -50,6 +56,7 @@ def check_relay():
else
:
else
:
print_green
(
'
STMP relay is properly set
'
)
print_green
(
'
STMP relay is properly set
'
)
def
send_test_email
():
def
send_test_email
():
print
(
'
Sending test email
'
)
print
(
'
Sending test email
'
)
global
all_ok
global
all_ok
...
@@ -64,6 +71,7 @@ def send_test_email():
...
@@ -64,6 +71,7 @@ def send_test_email():
else
:
else
:
print_green
(
'
Email sent
'
)
print_green
(
'
Email sent
'
)
if
not
os
.
path
.
exists
(
'
/etc/postfix
'
):
if
not
os
.
path
.
exists
(
'
/etc/postfix
'
):
print_red
(
'
Postfix dir does not exists, please install postfix.
'
)
print_red
(
'
Postfix dir does not exists, please install postfix.
'
)
all_ok
=
False
all_ok
=
False
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment