Esempio n. 1
0
    def from_json(cls, credentials, *args, **kwargs):
        """
        Return a CatmaidClientApplication instance whose underlying CatmaidClient object is instantiated from the JSON
        file as per its own from_json method.

        Parameters
        ----------
        path : str
            Path to the JSON credentials file
        args, kwargs
            Arguments passed to constructor of concrete subclass

        Returns
        -------
        CatmaidClient
            Instance of the API, authenticated with
        """
        return cls(CatmaidClient.from_json(credentials), *args, **kwargs)
Esempio n. 2
0
def test_from_json_dict(credentials_dict):
    c = CatmaidClient.from_json(credentials_dict)
    assert c.base_url == BASE_URL
    check_correct_token(c)
Esempio n. 3
0
def test_from_json_pathstr(credentials_file):
    c = CatmaidClient.from_json(credentials_file)
    assert c.base_url == BASE_URL
    check_correct_token(c)
Esempio n. 4
0
def test_from_json_pathlib(credentials_file):
    """Test that this would work even on a pathlib/pathlib2 Path instead of a str"""
    path = DummyPath(credentials_file)
    c = CatmaidClient.from_json(path)
    assert c.base_url == BASE_URL
    check_correct_token(c)