File: data_test.py

package info (click to toggle)
python-gdata 2.0.18%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 8,460 kB
  • ctags: 17,143
  • sloc: python: 70,779; ansic: 150; makefile: 27; sh: 3
file content (250 lines) | stat: -rw-r--r-- 7,153 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#!/usr/bin/python
#
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


__author__ = 'Claudio Cherubino <ccherubino@google.com>'


import unittest
import gdata.apps.emailsettings.data
import gdata.test_config as conf


class EmailSettingsLabelTest(unittest.TestCase):

  def setUp(self):
    self.entry = gdata.apps.emailsettings.data.EmailSettingsLabel()

  def testName(self):
    self.entry.name = 'test label'
    self.assertEquals(self.entry.name, 'test label')


class EmailSettingsFilterTest(unittest.TestCase):

  def setUp(self):
    self.entry = gdata.apps.emailsettings.data.EmailSettingsFilter()

  def testFrom(self):
    self.entry.from_address = 'abc@example.com'
    self.assertEquals(self.entry.from_address, 'abc@example.com')

  def testTo(self):
    self.entry.to_address = 'to@example.com'
    self.assertEquals(self.entry.to_address, 'to@example.com')

  def testFrom(self):
    self.entry.from_address = 'abc@example.com'
    self.assertEquals(self.entry.from_address, 'abc@example.com')

  def testSubject(self):
    self.entry.subject = 'Read me'
    self.assertEquals(self.entry.subject, 'Read me')

  def testHasTheWord(self):
    self.entry.has_the_word = 'important'
    self.assertEquals(self.entry.has_the_word, 'important')

  def testDoesNotHaveTheWord(self):
    self.entry.does_not_have_the_word = 'spam'
    self.assertEquals(self.entry.does_not_have_the_word, 'spam')

  def testHasAttachments(self):
    self.entry.has_attachments = True
    self.assertEquals(self.entry.has_attachments, True)

  def testLabel(self):
    self.entry.label = 'Trip reports'
    self.assertEquals(self.entry.label, 'Trip reports')

  def testMarkHasRead(self):
    self.entry.mark_has_read = True
    self.assertEquals(self.entry.mark_has_read, True)

  def testArchive(self):
    self.entry.archive = True
    self.assertEquals(self.entry.archive, True)


class EmailSettingsSendAsAliasTest(unittest.TestCase):

  def setUp(self):
    self.entry = gdata.apps.emailsettings.data.EmailSettingsSendAsAlias()

  def testName(self):
    self.entry.name = 'Sales'
    self.assertEquals(self.entry.name, 'Sales')

  def testAddress(self):
    self.entry.address = 'sales@example.com'
    self.assertEquals(self.entry.address, 'sales@example.com')

  def testReplyTo(self):
    self.entry.reply_to = 'support@example.com'
    self.assertEquals(self.entry.reply_to, 'support@example.com')

  def testMakeDefault(self):
    self.entry.make_default = True
    self.assertEquals(self.entry.make_default, True)


class EmailSettingsWebClipTest(unittest.TestCase):

  def setUp(self):
    self.entry = gdata.apps.emailsettings.data.EmailSettingsWebClip()

  def testEnable(self):
    self.entry.enable = True
    self.assertEquals(self.entry.enable, True)


class EmailSettingsForwardingTest(unittest.TestCase):

  def setUp(self):
    self.entry = gdata.apps.emailsettings.data.EmailSettingsForwarding()

  def testEnable(self):
    self.entry.enable = True
    self.assertEquals(self.entry.enable, True)

  def testForwardTo(self):
    self.entry.forward_to = 'fred@example.com'
    self.assertEquals(self.entry.forward_to, 'fred@example.com')

  def testAction(self):
    self.entry.action = 'KEEP'
    self.assertEquals(self.entry.action, 'KEEP')


class EmailSettingsPopTest(unittest.TestCase):

  def setUp(self):
    self.entry = gdata.apps.emailsettings.data.EmailSettingsPop()

  def testEnable(self):
    self.entry.enable = True
    self.assertEquals(self.entry.enable, True)

  def testForwardTo(self):
    self.entry.enable_for = 'ALL_MAIL'
    self.assertEquals(self.entry.enable_for, 'ALL_MAIL')

  def testAction(self):
    self.entry.action = 'KEEP'
    self.assertEquals(self.entry.action, 'KEEP')


class EmailSettingsImapTest(unittest.TestCase):

  def setUp(self):
    self.entry = gdata.apps.emailsettings.data.EmailSettingsImap()

  def testEnable(self):
    self.entry.enable = True
    self.assertEquals(self.entry.enable, True)


class EmailSettingsVacationResponderTest(unittest.TestCase):

  def setUp(self):
    self.entry = gdata.apps.emailsettings.data.EmailSettingsVacationResponder()

  def testEnable(self):
    self.entry.enable = True
    self.assertEquals(self.entry.enable, True)

  def testSubject(self):
    self.entry.subject = 'On vacation!'
    self.assertEquals(self.entry.subject, 'On vacation!')

  def testMessage(self):
    self.entry.message = 'See you on September 1st'
    self.assertEquals(self.entry.message, 'See you on September 1st')

  def testStartDate(self):
    self.entry.start_date = '2011-12-05'
    self.assertEquals(self.entry.start_date, '2011-12-05')
  
  def testEndDate(self):
    self.entry.end_date = '2011-12-06'
    self.assertEquals(self.entry.end_date, '2011-12-06')

  def testContactsOnly(self):
    self.entry.contacts_only = True
    self.assertEquals(self.entry.contacts_only, True)

  def testDomainOnly(self):
    self.entry.domain_only = True
    self.assertEquals(self.entry.domain_only, True)


class EmailSettingsSignatureTest(unittest.TestCase):

  def setUp(self):
    self.entry = gdata.apps.emailsettings.data.EmailSettingsSignature()

  def testValue(self):
    self.entry.signature_value = 'Regards, Joe'
    self.assertEquals(self.entry.signature_value, 'Regards, Joe')


class EmailSettingsLanguageTest(unittest.TestCase):

  def setUp(self):
    self.entry = gdata.apps.emailsettings.data.EmailSettingsLanguage()

  def testLanguage(self):
    self.entry.language_tag = 'es'
    self.assertEquals(self.entry.language_tag, 'es')


class EmailSettingsGeneralTest(unittest.TestCase):

  def setUp(self):
    self.entry = gdata.apps.emailsettings.data.EmailSettingsGeneral()

  def testPageSize(self):
    self.entry.page_size = 25
    self.assertEquals(self.entry.page_size, 25)

  def testShortcuts(self):
    self.entry.shortcuts = True
    self.assertEquals(self.entry.shortcuts, True)

  def testArrows(self):
    self.entry.arrows = True
    self.assertEquals(self.entry.arrows, True)

  def testSnippets(self):
    self.entry.snippets = True
    self.assertEquals(self.entry.snippets, True)

  def testUnicode(self):
    self.entry.use_unicode = True
    self.assertEquals(self.entry.use_unicode, True)


def suite():
  return conf.build_suite([EmailSettingsLabelTest, EmailSettingsFilterTest,
      EmailSettingsSendAsAliasTest, EmailSettingsWebClipTest,
      EmailSettingsForwardingTest, EmailSettingsPopTest,
      EmailSettingsImapTest, EmailSettingsVacationResponderTest,
      EmailSettingsSignatureTest, EmailSettingsLanguageTest,
      EmailSettingsGeneralTest])


if __name__ == '__main__':
  unittest.main()