Skip to content

Commit 90fd984

Browse files
committed
Testing email_send service - #350 [ci skip]
1 parent 7d5a372 commit 90fd984

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
#Copyright 2015 RAPP
5+
6+
#Licensed under the Apache License, Version 2.0 (the "License");
7+
#you may not use this file except in compliance with the License.
8+
#You may obtain a copy of the License at
9+
10+
#http://www.apache.org/licenses/LICENSE-2.0
11+
12+
#Unless required by applicable law or agreed to in writing, software
13+
#distributed under the License is distributed on an "AS IS" BASIS,
14+
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
#See the License for the specific language governing permissions and
16+
#limitations under the License.
17+
18+
# Authors: Konstantinos Panayiotou, Manos Tsardoulias
19+
20+
21+
import os
22+
import rospkg
23+
from os.path import join
24+
import unittest
25+
26+
__path__ = os.path.dirname(os.path.realpath(__file__))
27+
28+
from RappCloud import RappPlatformService
29+
from RappCloud.CloudMsgs import EmailSend
30+
# from RappCloud import RappPlatformAPI
31+
32+
33+
class EmailSendTests(unittest.TestCase):
34+
35+
def setUp(self):
36+
self.svc = RappPlatformService()
37+
self.pkgDir = rospkg.RosPack().get_path('rapp_testing_tools')
38+
39+
def test_single_attachment(self):
40+
attach = join(self.pkgDir, 'test_data', 'Lenna.png')
41+
42+
msg = EmailSend(
43+
44+
password='181289dj',
45+
server='smtp.gmail.com',
46+
port='587',
47+
recipients=['[email protected]'],
48+
body='Rapp Send Email Test',
49+
subject='Rapp Send Email Test',
50+
attach_file=attach)
51+
52+
resp = self.svc.call(msg)
53+
self.assertEqual(resp.error, u'')
54+
55+
def test_no_attachment(self):
56+
msg = EmailSend(
57+
58+
password='',
59+
server='smtp.gmail.com',
60+
port='587',
61+
recipients=['[email protected]'],
62+
body='Rapp Send Email Test',
63+
subject='Rapp Send Email Test')
64+
resp = self.svc.call(msg)
65+
self.assertEqual(resp.error, u'')
66+
67+
def test_multiple_files_zip(self):
68+
attach = join(self.pkgDir, 'test_data', 'zip_files',
69+
'image_audio_sample.zip')
70+
71+
msg = EmailSend(
72+
73+
password='',
74+
server='smtp.gmail.com',
75+
port='587',
76+
recipients=['[email protected]'],
77+
body='Rapp Send Email Test',
78+
subject='Rapp Send Email Test',
79+
attach_file=attach)
80+
81+
resp = self.svc.call(msg)
82+
self.assertEqual(resp.error, u'')
83+
84+
85+
if __name__ == "__main__":
86+
unittest.main()

0 commit comments

Comments
 (0)