Beispiel #1
0
class TestAuthorize(unittest.TestCase):
    """
    Test method VimBlogger._authorize
    """
    def setUp(self):
        """
        Create VimBlogger object (with good credentials, yes :>)
        """
        self.vimob = VimBlogger(None, shared.LOGIN, shared.PASS)

    def test_happy_case(self):
        """
        Try to login with good credentials
        """
        self.assertTrue(self.vimob._authorize(shared.LOGIN,
                                              shared.PASS) is None)

    def test_wrong_login(self):
        """
        Try to login with wrong login
        """
        self.assertRaises(shared.BadAuthentication, self.vimob._authorize,
                          'joe', shared.PASS)

    def test_wrong_pass(self):
        """
        Try to login with wrong password
        """
        self.assertRaises(shared.BadAuthentication, self.vimob._authorize,
                          'joe', shared.PASS)