mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
@@ -27,3 +27,15 @@ def modo_api_instance_create(url, request):
|
||||
def modo_api_instance_update(url, request):
|
||||
"""Simulate successful update."""
|
||||
return {"status_code": 200}
|
||||
|
||||
|
||||
@httmock.urlmatch(
|
||||
netloc=r"api\.modoboa\.org$", path=r"^/1/versions/", method="get")
|
||||
def modo_api_versions(url, request):
|
||||
"""Simulate versions check."""
|
||||
return {
|
||||
"status_code": 200,
|
||||
"content": [
|
||||
{"name": "modoboa", "version": "9.0.0", "url": ""},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -254,5 +254,11 @@ class APICommunicationTestCase(ModoTestCase):
|
||||
with httmock.HTTMock(
|
||||
mocks.modo_api_instance_search,
|
||||
mocks.modo_api_instance_create,
|
||||
mocks.modo_api_instance_update):
|
||||
mocks.modo_api_instance_update,
|
||||
mocks.modo_api_versions):
|
||||
management.call_command("communicate_with_public_api")
|
||||
self.assertEqual(models.LocalConfig.objects.first().api_pk, 100)
|
||||
|
||||
url = reverse("core:information")
|
||||
response = self.ajax_request("get", url)
|
||||
self.assertIn("9.0.0", response["content"])
|
||||
|
||||
Reference in New Issue
Block a user