Skip to content

Commit f5daeea

Browse files
committed
Merge branch 'master' into fix-typo-parsing
2 parents cd2d56c + 1381e42 commit f5daeea

File tree

3 files changed

+1
-54
lines changed

3 files changed

+1
-54
lines changed

mergin/cli.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@ def pretty_summary(summary):
9595
def get_token(url, username, password):
9696
"""Get authorization token for given user and password."""
9797
mc = MerginClient(url)
98-
if not mc.is_server_compatible():
99-
click.secho(str("This client version is incompatible with server, try to upgrade"), fg="red")
100-
return None
98+
10199
try:
102100
session = mc.login(username, password)
103101
except LoginError as e:

mergin/client.py

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -244,52 +244,6 @@ def patch(self, path, data=None, headers={}):
244244
request = urllib.request.Request(url, data, headers, method="PATCH")
245245
return self._do_request(request)
246246

247-
def is_server_compatible(self):
248-
"""
249-
Test whether version of the server meets the required set of endpoints.
250-
251-
:returns: client compatible with server
252-
rtype: Boolean
253-
"""
254-
resp = self.get("/ping")
255-
data = json.load(resp)
256-
if "endpoints" not in data:
257-
return False
258-
endpoints = data["endpoints"]
259-
260-
client_endpoints = {
261-
"data_sync": {
262-
"GET": ["/project/raw/{namespace}/{project_name}"],
263-
"POST": [
264-
"/project/push/cancel/{transaction_id}",
265-
"/project/push/finish/{transaction_id}",
266-
"/project/push/{namespace}/{project_name}",
267-
# "/project/push/chunk/{transaction_id}/{chunk_id}" # issue in server
268-
],
269-
},
270-
"project": {
271-
"DELETE": ["/project/{namespace}/{project_name}"],
272-
"GET": [
273-
"/project",
274-
"/project/{namespace}/{project_name}",
275-
"/project/version/{namespace}/{project_name}",
276-
],
277-
"POST": ["/project/{namespace}"],
278-
},
279-
"user": {"POST": ["/auth/login"]},
280-
}
281-
282-
for k, v in client_endpoints.items():
283-
if k not in endpoints:
284-
return False
285-
for method, url_list in v.items():
286-
if method not in endpoints[k]:
287-
return False
288-
for url in url_list:
289-
if url not in endpoints[k][method]:
290-
return False
291-
return True
292-
293247
def login(self, login, password):
294248
"""
295249
Authenticate login credentials and store session token

mergin/test/test_client.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,11 +1058,6 @@ def test_logging(mc):
10581058
del os.environ["MERGIN_CLIENT_LOG"]
10591059

10601060

1061-
def test_server_compatibility(mc):
1062-
"""Test server compatibility."""
1063-
assert mc.is_server_compatible()
1064-
1065-
10661061
def create_versioned_project(mc, project_name, project_dir, updated_file, remove=True, overwrite=False):
10671062
project = API_USER + "/" + project_name
10681063
cleanup(mc, project, [project_dir])

0 commit comments

Comments
 (0)