Skip to content

Commit 2009506

Browse files
test: Gmail UTs (#338)
* test: region tag update * test: Updated region tag * test: gmail UTs * test: gmail UTs * test: gmail UTs * test: deleted send_mail file * test: gmail UTs
1 parent bc61a48 commit 2009506

18 files changed

Lines changed: 444 additions & 83 deletions

gmail/snippet/send mail/send_message_with_attachment.py

Lines changed: 0 additions & 81 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
16+
import unittest
17+
18+
from create_draft import gmail_create_draft
19+
20+
21+
class TestCreateDraft(unittest.TestCase):
22+
"""Unit test classs for snippet"""
23+
24+
@classmethod
25+
def test_create_draft(cls):
26+
"""Unit test for create draft"""
27+
draft = gmail_create_draft()
28+
cls.assertIsNotNone(cls, draft)
29+
30+
31+
if __name__ == '__main__':
32+
unittest.main()
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
16+
import unittest
17+
18+
from create_draft_with_attachment import gmail_create_draft_with_attachment
19+
20+
21+
class TestCreateDraftWithAttachment(unittest.TestCase):
22+
"""Unit test classs for Change snippet"""
23+
24+
@classmethod
25+
def test_create_draft_with_attachment(cls):
26+
"""Test create draft with attachment"""
27+
draft = gmail_create_draft_with_attachment()
28+
cls.assertIsNotNone(cls, draft)
29+
30+
31+
if __name__ == '__main__':
32+
unittest.main()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
from send_message import gmail_send_message
18+
19+
20+
class TestSendMessage(unittest.TestCase):
21+
"""Unit test class for snippet"""
22+
23+
def test_send_message(self):
24+
"""test send message"""
25+
send_message = gmail_send_message()
26+
self.assertIsNotNone(self, send_message)
27+
28+
29+
if __name__ == '__main__':
30+
unittest.main()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
from send_message_with_attachment import gmail_send_message_with_attachment
18+
19+
20+
class TestSendMessageWithAttachment(unittest.TestCase):
21+
"""Unit test class for gmail snippet"""
22+
23+
def test_send_message_with_attachment(self):
24+
""" test send message with attachment"""
25+
send_message = gmail_send_message_with_attachment()
26+
self.assertIsNotNone(self, send_message)
27+
28+
29+
if __name__ == '__main__':
30+
unittest.main()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
from create_filter import create_filter
18+
19+
20+
class TestCreateFilter(unittest.TestCase):
21+
"""Unit test class to implement test case for Snippets"""
22+
23+
@classmethod
24+
def test_create_file(cls):
25+
"""test to create file"""
26+
result = create_filter()
27+
cls.assertIsNotNone(cls, result)
28+
29+
30+
if __name__ == '__main__':
31+
unittest.main()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
from enable_auto_reply import enable_auto_reply
18+
19+
20+
class TestEnableAutoReply(unittest.TestCase):
21+
"""Unit test class for the snippet"""
22+
23+
@classmethod
24+
def test_enable_auto_reply(cls):
25+
""" test to enable auto reply"""
26+
result = enable_auto_reply()
27+
cls.assertIsNotNone(cls, result)
28+
29+
30+
if __name__ == '__main__':
31+
unittest.main()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
from enable_forwarding import enable_forwarding
18+
19+
20+
class TestEnableForwarding(unittest.TestCase):
21+
"""Unit test class to test enable forwarding snippet"""
22+
23+
@classmethod
24+
def test_enable_forwarding(cls):
25+
"""test to enable forwarding"""
26+
result = enable_forwarding()
27+
cls.assertIsNotNone(cls, result)
28+
29+
30+
if __name__ == '__main__':
31+
unittest.main()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
from update_signature import update_signature
18+
19+
20+
class TestUpdateSignature(unittest.TestCase):
21+
"""Unit test class to test Update signature snippet"""
22+
23+
@classmethod
24+
def test_update_signature(cls):
25+
""" test to update signature"""
26+
result = update_signature()
27+
cls.assertIsNotNone(cls, result)
28+
29+
30+
if __name__ == '__main__':
31+
unittest.main()

gmail/snippet/smime snippets/insert_cert_from_csv.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def insert_cert_from_csv(csv_filename):
4343
insert_smime_info.insert_smime_info()
4444
else:
4545
print(F'Unable to read certificate file for user_id: {user_id}')
46+
return smime_info
4647

4748
except (OSError, IOError) as error:
4849
print(F'An error occured while reading the CSV file: {error}')

0 commit comments

Comments
 (0)