Example #1
0
    def run_tests(self):
        from imapclient.test.util import unittest  # this will import unittest2

        module = "__main__"
        if IS_PY_26_OR_OLDER or IS_PY_34_OR_NEWER:
            module = None
        unittest.main(argv=["", "discover"], module=module)
Example #2
0
def main():
    host_config = parse_argv()

    namespace = probe_host(**host_config)
    host_config['namespace'] = namespace

    live_test_mod = imp.new_module('livetests')
    sys.modules['livetests'] = live_test_mod

    def add_test_class(name, klass):
       klass.__name__ = name
       setattr(live_test_mod, name, klass)

    add_test_class('TestWithUIDs', createLiveTestClass(use_uid=True, **host_config))
    add_test_class('TestWithoutUIDs', createLiveTestClass(use_uid=False, **host_config))

    unittest.main(module='livetests')
Example #3
0
 def run_tests(self):
     from imapclient.test.util import unittest  # this will import unittest2
     module = "__main__"
     if IS_PY_26_OR_OLDER or IS_PY_34_OR_NEWER:
         module = None
     unittest.main(argv=['', 'discover'], module=module)
        self.assertSequenceEqual(threads, ((1, 2), (3,), (4, 5, 6)))

    def test_no_support(self):
        self.client._cached_capabilities = ('NOT-THREAD',)
        self.assertRaises(ValueError, self.client.thread)

    def test_no_support2(self):
        self.client._cached_capabilities = ('THREAD=FOO',)
        self.assertRaises(ValueError, self.client.thread)

    def test_all_args_with_uid(self):
        self.client._cached_capabilities = ('THREAD=FOO',)
        self.client._imap.uid.return_value = ('OK', [])

        self.client.thread(algorithm='FOO', criteria='STUFF', charset='ASCII')

        self.client._imap.uid.assert_called_once_with('thread', 'FOO', 'ASCII', '(STUFF)')

    def test_all_args_without_uid(self):
        self.client.use_uid = False
        self.client._cached_capabilities = ('THREAD=FOO',)
        self.client._imap.thread.return_value = ('OK', [])

        self.client.thread(algorithm='FOO', criteria='STUFF', charset='ASCII')

        self.client._imap.thread.assert_called_once_with('FOO', 'ASCII','(STUFF)')

if __name__ == '__main__':
    unittest.main()
Example #5
0
    def test_no_support(self):
        self.client._cached_capabilities = ('NOT-THREAD', )
        self.assertRaises(ValueError, self.client.thread)

    def test_no_support2(self):
        self.client._cached_capabilities = ('THREAD=FOO', )
        self.assertRaises(ValueError, self.client.thread)

    def test_all_args_with_uid(self):
        self.client._cached_capabilities = ('THREAD=FOO', )
        self.client._imap.uid.return_value = ('OK', [])

        self.client.thread(algorithm='FOO', criteria='STUFF', charset='ASCII')

        self.client._imap.uid.assert_called_once_with('thread', 'FOO', 'ASCII',
                                                      '(STUFF)')

    def test_all_args_without_uid(self):
        self.client.use_uid = False
        self.client._cached_capabilities = ('THREAD=FOO', )
        self.client._imap.thread.return_value = ('OK', [])

        self.client.thread(algorithm='FOO', criteria='STUFF', charset='ASCII')

        self.client._imap.thread.assert_called_once_with(
            'FOO', 'ASCII', '(STUFF)')


if __name__ == '__main__':
    unittest.main()
Example #6
0
 def run_tests(self):
     from imapclient.test.util import unittest  # this will import unittest2
     unittest.main(argv=['', 'discover'])
Example #7
0
 def run_tests(self):
     from imapclient.test.util import unittest   # this will import unittest2
     unittest.main(argv=['', 'discover'])