def test_get(self):
        sot = _key.Key(id=EXAMPLE['key_id'])
        mock_response = mock.Mock()
        mock_response.status_code = 200
        mock_response.headers = {}
        mock_response.json.return_value = {'key_info': EXAMPLE.copy()}

        self.sess.post.return_value = mock_response

        result = sot.fetch(self.sess)

        self.sess.post.assert_called_once_with(
            '/kms/describe-key', json={'key_id': EXAMPLE['key_id']})

        self.assertEqual(sot, result)
        self.assertEqual(EXAMPLE['key_id'], sot.id)
        self.assertEqual(EXAMPLE['domain_id'], sot.domain_id)
        self.assertEqual(EXAMPLE['domain_id'], sot.domain_id)
        self.assertEqual(EXAMPLE['key_alias'], sot.key_alias)
        self.assertEqual(EXAMPLE['realm'], sot.realm)
        self.assertEqual(EXAMPLE['key_description'], sot.key_description)
        self.assertEqual(EXAMPLE['creation_date'], sot.creation_date)
        self.assertEqual(EXAMPLE['scheduled_deletion_date'],
                         sot.scheduled_deletion_date)
        self.assertEqual(EXAMPLE['key_state'], sot.key_state)
        self.assertEqual(EXAMPLE['default_key_flag'], sot.default_key_flag)
        self.assertEqual(EXAMPLE['key_type'], sot.key_type)
 def test_basic(self):
     sot = _key.Key()
     self.assertEqual('key_info', sot.resource_key)
     self.assertEqual('key_details', sot.resources_key)
     self.assertEqual('/kms', sot.base_path)
     self.assertEqual('/kms/list-keys', sot.list_path)
     self.assertTrue(sot.allow_list)
     self.assertTrue(sot.allow_create)
     self.assertTrue(sot.allow_get)
     self.assertFalse(sot.allow_update)
     self.assertFalse(sot.allow_delete)
 def setUp(self):
     super(TestKey, self).setUp()
     self.sess = mock.Mock(spec=adapter.Adapter)
     self.sess.post = mock.Mock()
     self.sot = _key.Key()