Ejemplo n.º 1
0
    def mock_upload(self, metadata=None):
        upload = from_fixture_json("upload_metadata")
        url = self.get_files_url(metadata).with_query({
            "conflict": "warn",
            "kind": "file",
            "name": "test.txt"
        })

        if metadata:
            self.put(url, payload=upload)
        else:
            self.put(url, payload=upload)
Ejemplo n.º 2
0
    def mock_409(self, metadata=None):
        conflict = from_fixture_json("conflict_metadata")
        url = self.get_files_url(metadata["data"]["id"])

        if metadata:
            self.post(url, payload=conflict)
        else:
            url = url.with_query({
                "kind": "file",
                "name": "test",
                "conflict": "warn"
            })
            self.put(url, payload=conflict)
Ejemplo n.º 3
0
    async def test_versions(self, server, provider):
        file_json = server.get_file_json()
        file_item = server.get_file_item()

        server.mock_versions(file_json, from_fixture_json("versions_metadata"))

        versions = await provider.versions(file_item)

        assert isinstance(versions, list)
        assert len(versions) == 2

        item = versions[0]
        assert item.id == "/5b6ee0c390a7e0001986aff5"
        assert item.path == "/5b6ee0c390a7e0001986aff5"
        assert item.name == "test.txt"
        assert item.kind == "file"
        assert item.mimetype == "text/plain"
Ejemplo n.º 4
0
 def get_version_json(self):
     return from_fixture_json("versions_metadata")
Ejemplo n.º 5
0
 def get_folder_json(self):
     return from_fixture_json("folder_metadata")
Ejemplo n.º 6
0
 def get_children_json(self):
     return from_fixture_json("children_metadata")
Ejemplo n.º 7
0
 def get_file_json(self):
     return from_fixture_json("file_metadata")
Ejemplo n.º 8
0
 def mock_rename(self, metadata):
     url = self.get_files_url(metadata)
     upload = from_fixture_json("upload_metadata")
     self.post(url, payload=upload)