~hazmat/pyjuju/rapi-delta

« back to all changes in this revision

Viewing changes to juju/tests/test_errors.py

  • Committer: Kapil Thangavelu
  • Date: 2012-09-19 20:38:44 UTC
  • mfrom: (573.1.6 rest-context)
  • Revision ID: kapil@canonical.com-20120919203844-dc2pf82ttm7xj3xs
Merged rest-context into rapi-delta.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
    CannotTerminateMachine, MachinesNotFound, EnvironmentPending,
6
6
    EnvironmentNotFound, IncompatibleVersion, InvalidPlacementPolicy,
7
7
    ServiceError, ConstraintError, UnknownConstraintError,
8
 
    SSLVerificationError)
 
8
    SSLVerificationError, SSLVerificationUnsupported)
9
9
 
10
10
from juju.lib.testing import TestCase
11
11
 
153
153
        self.assertEquals(str(error), "Cannot upgrade charm: blah blah")
154
154
 
155
155
    def test_SSLVerificationError(self):
156
 
        error = SSLVerificationError("endpoint")
157
 
        self.assertIsJujuError(error)
158
 
        self.assertEquals(str(error),
159
 
                "An SSL endpoint failed verification: endpoint")
 
156
        orig_error = Exception()
 
157
        error = SSLVerificationError(orig_error)
 
158
        self.assertIsJujuError(error)
 
159
        self.assertIs(orig_error, error.ssl_error)
 
160
        self.assertIn("Bad HTTPS certificate", str(error))
 
161
 
 
162
    def test_SSLVerificationUnsupported(self):
 
163
        error = SSLVerificationUnsupported()
 
164
        self.assertIsJujuError(error)
 
165
        self.assertIn("HTTPS certificates cannot be verified", str(error))