def test_ccache_is_not_valid(self):
        err_codes = (krbV.KRB5_FCC_NOFILE,
                     krbV.KRB5_CC_FORMAT,
                     krbV.KRB5_CC_NOTFOUND)

        for err_code in err_codes:
            with patch('krbcontext.context.get_tgt_time',
                       side_effect=krbV.Krb5Error(err_code, '')):
                result = is_initialize_ccache_necessary(self.context, self.ccache, self.principal)
                self.assertTrue(result)
    def test_dont_init_ccache_is_not_expired(self, get_tgt_time):
        get_tgt_time.return_value = get_fake_cred_time(expired=False)

        result = is_initialize_ccache_necessary(self.context, self.ccache, self.principal)
        self.assertFalse(result)