# Path: shelf/link_title.py
# class LinkTitle(object):
#     ARTIFACT_LIST = "artifact-list"
#     ARTIFACT_ROOT = "artifact-root"
#     ARTIFACT = "artifact"
#     METADATA = "metadata"


from StringIO import StringIO
from shelf.link_title import LinkTitle
from tests.functional_test_base import FunctionalTestBase
    def test_artifact_head_from_root(self):
            self.artifact_head_request("", 204, headers={
                "Link": [
                    "</test/artifact/empty>; rel=\"item\"; title=\"{0}\"".format(LinkTitle.ARTIFACT),
                    "</test/artifact/test>; rel=\"item\"; title=\"{0}\"".format(LinkTitle.ARTIFACT),
                    "</test/artifact/dir/>; rel=\"collection\"; title=\"{0}\"".format(LinkTitle.ARTIFACT_LIST),
                    "</test/artifact/this/>; rel=\"collection\"; title=\"{0}\"".format(LinkTitle.ARTIFACT_LIST)
                ]
            })

    def test_head_request_on_artifact(self):
        self.artifact_head_request("/test", 204, headers={
            "Link": [
                "</test/artifact/test>; rel=\"self\"; title=\"{0}\"".format(LinkTitle.ARTIFACT),
                "</test/artifact/test/_meta>; rel=\"related\"; title=\"{0}\"".format(LinkTitle.METADATA)
            ]
        })

    def test_head_request_no_artifact(self):
        self.artifact_head_request("/LOL_DOES-nOtExist", 404)

    def test_head_no_permissions(self):
        self.artifact_head_request("dir/test", 401)

    def test_artifact_upload(self):
        self.route_tester.artifact() \
            .route_params(bucket_name="test", path="test-2") \
            .expect(201, headers={
                "Link": [
                    "</test/artifact/test-2>; rel=\"self\"; title=\"{0}\"".format(LinkTitle.ARTIFACT),

# Path: shelf/link_title.py
# class LinkTitle(object):
#     ARTIFACT_LIST = "artifact-list"
#     ARTIFACT_ROOT = "artifact-root"
#     ARTIFACT = "artifact"
#     METADATA = "metadata"


# Path: tests/routes/artifact_test.py
from StringIO import StringIO
from shelf.link_title import LinkTitle
from tests.functional_test_base import FunctionalTestBase

    def test_artifact_head_from_root(self):
            self.artifact_head_request("", 204, headers={
                "Link": [
                    "</test/artifact/empty>; rel=\"item\"; title=\"{0}\"".format(LinkTitle.ARTIFACT),
                    "</test/artifact/test>; rel=\"item\"; title=\"{0}\"".format(LinkTitle.ARTIFACT),
                    "</test/artifact/dir/>; rel=\"collection\"; title=\"{0}\"".format(LinkTitle.ARTIFACT_LIST),
                    "</test/artifact/this/>; rel=\"collection\"; title=\"{0}\"".format(LinkTitle.ARTIFACT_LIST)
                ]
            })

    def test_head_request_on_artifact(self):
        self.artifact_head_request("/test", 204, headers={
            "Link": [
                "</test/artifact/test>; rel=\"self\"; title=\"{0}\"".format(LinkTitle.ARTIFACT),
                "</test/artifact/test/_meta>; rel=\"related\"; title=\"{0}\"".format(LinkTitle.METADATA)
            ]
        })

    def test_head_request_no_artifact(self):
        self.artifact_head_request("/LOL_DOES-nOtExist", 404)

    def test_head_no_permissions(self):
        self.artifact_head_request("dir/test", 401)

    def test_artifact_upload(self):
        self.route_tester.artifact() \
            .route_params(bucket_name="test", path="test-2") \
            .expect(201, headers={
                "Link": [
                    "</test/artifact/test-2>; rel=\"self\"; title=\"{0}\"".format(LinkTitle.ARTIFACT),

                    "</test/artifact/test-2/_meta>; rel=\"related\"; title=\"{0}\"".format(LinkTitle.METADATA)