old_contents: from unittest import TestCase
  from webtest import TestApp
  from deuce.tests import FunctionalTest
  
  
  class TestVaultController(FunctionalTest):
  
      def setUp(self):
          super(TestVaultController, self).setUp()
  
          self._hdrs = {"X-Project-ID": "sample_project_id"}
  
      def test_vault_leaf(self):
          response = self.app.get('/v1.0/', headers=self._hdrs,
              expect_errors=True)
  
          assert response.status_int == 404
  
      def test_invalid_vault_id(self):
          vault_name = '@#$@#$@$'
          vault_path = '/v1.0/{0}'.format(vault_name)
  
          response = self.app.post(vault_path, headers=self._hdrs,
                  expect_errors=True)
          self.assertEqual(response.status_int, 400)
  
          response = self.app.get(vault_path, headers=self._hdrs,
                  expect_errors=True)
          self.assertEqual(response.status_int, 404)
  
      def test_vault_crud(self):
          vault_name = 'my_new_vault'
          vault_path = '/v1.0/{0}'.format(vault_name)
  
          # If we try to get the vault before it exists, it should
          # return a 404
          response = self.app.get(vault_path,
              headers=self._hdrs, expect_errors=True)
  
          assert response.status_code == 404
  
          # Now we create the vault, which should return a 201 (created)
          response = self.app.post(vault_path, headers=self._hdrs)
          assert response.status_code == 201
  
          # Now if we get the vault, what do we get? For now,
          # let's enforce that we get a 204 (No Content)
          response = self.app.get(vault_path, headers=self._hdrs,
              expect_errors=True)
  
          assert response.status_code == 200
  
          # Now delete the vault (this should be OK since it
          # contains nothing in it.
          response = self.app.delete(vault_path, headers=self._hdrs,
              expect_errors=True)
  
          assert response.status_code == 200
  
          # Now we should get a 404 when trying to get the vault
          response = self.app.get(vault_path, headers=self._hdrs,
              expect_errors=True)
  
          assert response.status_code == 404
  
          # Try to delete again, this time it should be a 404
          response = self.app.delete(vault_path, headers=self._hdrs,
              expect_errors=True)
  
          assert response.status_code == 404
  
new_contents: from unittest import TestCase
  from webtest import TestApp
  from deuce.tests import FunctionalTest
  
  
  class TestVaultController(FunctionalTest):
  
      def setUp(self):
          super(TestVaultController, self).setUp()
  
          self._hdrs = {"X-Project-ID": "sample_project_id"}
  
      def test_vault_leaf(self):
          response = self.app.get('/v1.0/', headers=self._hdrs,
              expect_errors=True)
  
          assert response.status_int == 404
  
      def test_invalid_vault_id(self):
          vault_name = '@#$@#$@$'
          vault_path = '/v1.0/{0}'.format(vault_name)
  
          response = self.app.post(vault_path, headers=self._hdrs,
                  expect_errors=True)
          self.assertEqual(response.status_int, 400)
  
          response = self.app.get(vault_path, headers=self._hdrs,
                  expect_errors=True)
          self.assertEqual(response.status_int, 404)
  
      def test_vault_crud(self):
          vault_name = 'my_new_vault'
          vault_path = '/v1.0/{0}'.format(vault_name)
  
          # If we try to get the vault before it exists, it should
          # return a 404
          response = self.app.get(vault_path,
              headers=self._hdrs, expect_errors=True)
  
          assert response.status_code == 404
  
          # Now we create the vault, which should return a 201 (created)
          response = self.app.post(vault_path, headers=self._hdrs)
          assert response.status_code == 201
  
          # Now if we get the vault, what do we get? For now,
          # let's enforce that we get a 204 (No Content)
          response = self.app.get(vault_path, headers=self._hdrs)
  
          assert response.status_code == 200
  
          # Now delete the vault (this should be OK since it
          # contains nothing in it.
          response = self.app.delete(vault_path, headers=self._hdrs,
              expect_errors=True)
  
          assert response.status_code == 200
  
          # Now we should get a 404 when trying to get the vault
          response = self.app.get(vault_path, headers=self._hdrs,
              expect_errors=True)
  
          assert response.status_code == 404
  
          # Try to delete again, this time it should be a 404
          response = self.app.delete(vault_path, headers=self._hdrs,
              expect_errors=True)
  
          assert response.status_code == 404
  
subject: Correct call should expect no error.