def test_create_deployment(self):
        self.response.status_code = 201
        self.response.headers["location"] = "/deployment/new_ref"
        nickname = "devops"
        description = "devops deployment"
        create_data = {"deployment[nickname]": nickname, "deployment[description]": description}
        expected = urlencode(create_data)

        success, location = righteous.create_deployment(nickname, description)
        self.request.assert_called_once_with("/deployments", method="POST", body=expected)
        assert success
        self.assertEqual(location, "/deployment/new_ref")
    def test_create_server_template(self):
        nickname = 'templator'
        description = 'uber template for the masses'
        cloud_image_href = '/foo/bar'

        new_template_href = '/template/new'
        self.response.status_code = 201
        self.response.headers['location'] = new_template_href

        success, location = righteous.create_server_template(
            nickname, description, cloud_image_href)
        assert success
        self.assertEqual(location, new_template_href)

        body = urlencode({
            'server_template[nickname]': nickname,
            'server_template[description]': description,
            'server_template[multi_cloud_image_href]': cloud_image_href,
        })

        self.request.assert_called_once_with(
            '/server_templates', method='POST', body=body)