~hazmat/pyjuju/rapi-delta

« back to all changes in this revision

Viewing changes to juju/state/tests/test_security.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:
1
1
import base64
2
 
import yaml
3
2
import zookeeper
4
3
 
5
4
from twisted.internet.defer import inlineCallbacks, succeed
11
10
    ACL, Principal, GroupPrincipal, OTPPrincipal, TokenDatabase,
12
11
    SecurityPolicy, SecurityPolicyConnection)
13
12
 
 
13
from juju.lib import serializer
14
14
from juju.lib.testing import TestCase
15
15
from juju.tests.common import get_test_zookeeper_address
16
16
 
230
230
 
231
231
        data, stat = yield self.client.get(otp_path)
232
232
 
233
 
        credentials = yaml.load(data)
 
233
        credentials = serializer.load(data)
234
234
        self.assertEqual(credentials["name"], "foobar")
235
235
        self.assertEqual(credentials["password"], "secret")
236
236
 
291
291
        principal = Principal("zebra", "zoo")
292
292
        yield self.db.add(principal)
293
293
        content, stat = yield self.client.get("/token-test")
294
 
        data = yaml.load(content)
 
294
        data = serializer.load(content)
295
295
        self.assertEqual(data, {"zebra": principal.get_token()})
296
296
 
297
297
    @inlineCallbacks
300
300
        yield self.db.add(principal)
301
301
        yield self.db.remove(principal)
302
302
        content, stat = yield self.client.get("/token-test")
303
 
        data = yaml.load(content)
 
303
        data = serializer.load(content)
304
304
        self.assertEqual(data, {"zebra": principal.get_token()})
305
305
 
306
306
    @inlineCallbacks