Skip to content

Commit

Permalink
fix failing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
icgood committed Oct 1, 2015
1 parent d473319 commit a916344
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions test/test_parsing_command_nonauth.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@

import unittest
from unittest.mock import patch, MagicMock

from pysasl import ServerMechanism

from pymap.parsing import NotParseable
from pymap.parsing.command import * # NOQA
from pymap.parsing.command.nonauth import * # NOQA


class TestAuthenticateCommand(unittest.TestCase):

@patch.object(ServerMechanism, 'get_available')
def test_parse(self, get_mock):
plain_mock = MagicMock()
get_mock.return_value = {'PLAIN': plain_mock}
def test_parse(self):
ret, buf = AuthenticateCommand._parse(b'tag', b' PLAIN\n ')
self.assertEqual(b'tag', ret.tag)
self.assertEqual(plain_mock(), ret.mech)
self.assertEqual(b'PLAIN', ret.mech_name)
self.assertEqual(b' ', buf)

@patch.object(ServerMechanism, 'get_available')
def test_parse_error(self, get_mock):
get_mock.return_value = {}
with self.assertRaises(NotParseable):
AuthenticateCommand._parse(b'tag', b' PLAIN\n ')


class TestLoginCommand(unittest.TestCase):

Expand Down

0 comments on commit a916344

Please sign in to comment.