From f696613a07da579a56eb430ed2ccbae2870da079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Opa=C5=82czy=C5=84ski?= Date: Fri, 28 Oct 2016 15:26:52 +0200 Subject: [PATCH 01/11] [LIB-965] update hosting after CORE changes; --- syncano/models/hosting.py | 4 +++- tests/integration_tests_hosting.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/syncano/models/hosting.py b/syncano/models/hosting.py index ab80819..0a31ed8 100644 --- a/syncano/models/hosting.py +++ b/syncano/models/hosting.py @@ -9,7 +9,9 @@ class Hosting(Model): OO wrapper around hosting. """ - label = fields.StringField(max_length=64, primary_key=True) + name = fields.StringField(max_length=253) + is_default = fields.BooleanField(read_only=True) + is_active = fields.BooleanField(default=True) description = fields.StringField(read_only=False, required=False) domains = fields.ListField(default=[]) diff --git a/tests/integration_tests_hosting.py b/tests/integration_tests_hosting.py index 1be56a5..72005cb 100644 --- a/tests/integration_tests_hosting.py +++ b/tests/integration_tests_hosting.py @@ -15,7 +15,7 @@ class HostingIntegrationTests(InstanceMixin, IntegrationTest): def setUp(self): self.hosting = self.instance.hostings.create( - label='test12', + name='test12', description='desc', domains=['test.test{}.io'.format(uuid.uuid4().hex[:5])] ) @@ -30,7 +30,7 @@ def test_create_file(self): def test_set_default(self): hosting = self.hosting.set_default() - self.assertIn('default', hosting.domains) + self.assertTrue('default', hosting.is_default) def test_update_file(self): a_hosting_file = StringIO() From 74c978c4f7f67d4a3410ee7be2333f9e820ca6a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Opa=C5=82czy=C5=84ski?= Date: Fri, 28 Oct 2016 15:36:48 +0200 Subject: [PATCH 02/11] [LIB-965] correct imports; --- syncano/models/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syncano/models/base.py b/syncano/models/base.py index 015217b..2f4eeeb 100644 --- a/syncano/models/base.py +++ b/syncano/models/base.py @@ -11,7 +11,7 @@ from .push_notification import * # NOQA from .geo import * # NOQA from .backups import * # NOQA -from .hosting import * # NOQA +from .hosting import Hosting, HostingFile # NOQA from .data_views import DataEndpoint as EndpointData # NOQA from .custom_sockets import * # NOQA from .custom_sockets_utils import Endpoint, ScriptCall, ScriptDependency, ClassDependency # NOQA From 785da5c0abefca1a98db98aa9759e6f74a88ff75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Opa=C5=82czy=C5=84ski?= Date: Fri, 28 Oct 2016 15:44:42 +0200 Subject: [PATCH 03/11] [LIB-965] correct imports; --- syncano/models/hosting.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/syncano/models/hosting.py b/syncano/models/hosting.py index 0a31ed8..e74ee22 100644 --- a/syncano/models/hosting.py +++ b/syncano/models/hosting.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- from . import fields -from .base import Instance, Model, logger +from .instances import Instance +from .archetypes import Model +from syncano import logger class Hosting(Model): From fa2bbc3a38de1fec1622177d5f863a6062a6df61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Opa=C5=82czy=C5=84ski?= Date: Fri, 28 Oct 2016 15:47:28 +0200 Subject: [PATCH 04/11] [LIB-965] isort issue corrct; --- syncano/models/hosting.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/syncano/models/hosting.py b/syncano/models/hosting.py index e74ee22..548a1d4 100644 --- a/syncano/models/hosting.py +++ b/syncano/models/hosting.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- +from syncano import logger + from . import fields -from .instances import Instance from .archetypes import Model -from syncano import logger +from .instances import Instance class Hosting(Model): From fea8e70a1f3438d11ee1c42bdaa7598242045c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Opa=C5=82czy=C5=84ski?= Date: Fri, 28 Oct 2016 15:59:52 +0200 Subject: [PATCH 05/11] [LIB-965] imports corrects; --- syncano/models/hosting.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/syncano/models/hosting.py b/syncano/models/hosting.py index 548a1d4..48b95e4 100644 --- a/syncano/models/hosting.py +++ b/syncano/models/hosting.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- -from syncano import logger - from . import fields -from .archetypes import Model +from .base import Model from .instances import Instance @@ -18,7 +16,6 @@ class Hosting(Model): description = fields.StringField(read_only=False, required=False) domains = fields.ListField(default=[]) - id = fields.IntegerField(read_only=True) links = fields.LinksField() created_at = fields.DateTimeField(read_only=True, required=False) updated_at = fields.DateTimeField(read_only=True, required=False) @@ -50,7 +47,6 @@ def upload_file(self, path, file): response = connection.session.post('{}{}'.format(connection.host, files_path), headers=headers, data=data, files=[('file', file)]) if response.status_code != 201: - logger.error(response.text) return return HostingFile(**response.json()) @@ -79,7 +75,6 @@ def update_file(self, path, file): response = connection.session.patch('{}{}'.format(connection.host, hosting_file.links.self), headers=headers, files=[('file', file)]) if response.status_code != 200: - logger.error(response.text) return return HostingFile(**response.json()) From 12198dbaed19c921c61787b3383eb9114f0ba610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Opa=C5=82czy=C5=84ski?= Date: Fri, 28 Oct 2016 16:14:23 +0200 Subject: [PATCH 06/11] [LIB-965] correct hosting tests; --- tests/integration_tests_hosting.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/integration_tests_hosting.py b/tests/integration_tests_hosting.py index 72005cb..41e2eb9 100644 --- a/tests/integration_tests_hosting.py +++ b/tests/integration_tests_hosting.py @@ -13,35 +13,38 @@ class HostingIntegrationTests(InstanceMixin, IntegrationTest): - def setUp(self): - self.hosting = self.instance.hostings.create( - name='test12', - description='desc', - domains=['test.test{}.io'.format(uuid.uuid4().hex[:5])] - ) - def test_create_file(self): + hosting = self._create_hosting('created_xyz') a_hosting_file = StringIO() a_hosting_file.write('h1 {color: #541231;}') a_hosting_file.seek(0) - hosting_file = self.hosting.upload_file(path='styles/main.css', file=a_hosting_file) + hosting_file = hosting.upload_file(path='styles/main.css', file=a_hosting_file) self.assertEqual(hosting_file.path, 'styles/main.css') def test_set_default(self): - hosting = self.hosting.set_default() + hosting = self._create_hosting('default_xyz') + hosting = hosting.set_default() self.assertTrue('default', hosting.is_default) def test_update_file(self): + hosting = self._create_hosting('update_xyz') a_hosting_file = StringIO() a_hosting_file.write('h1 {color: #541231;}') a_hosting_file.seek(0) - self.hosting.upload_file(path='styles/main.css', file=a_hosting_file) + hosting.upload_file(path='styles/main.css', file=a_hosting_file) a_hosting_file = StringIO() a_hosting_file.write('h2 {color: #541231;}') a_hosting_file.seek(0) - hosting_file = self.hosting.update_file(path='styles/main.css', file=a_hosting_file) + hosting_file = hosting.update_file(path='styles/main.css', file=a_hosting_file) self.assertEqual(hosting_file.path, 'styles/main.css') + + def _create_hosting(self, name): + return self.instance.hostings.create( + name=name, + description='desc', + domains=['test.test{}.io'.format(uuid.uuid4().hex[:5])] + ) From 7ba0ffa2b6dad255131184a9d35efc6e95efab00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Opa=C5=82czy=C5=84ski?= Date: Fri, 28 Oct 2016 16:18:43 +0200 Subject: [PATCH 07/11] [LIB-965] correct hosting tests; --- tests/integration_tests_hosting.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration_tests_hosting.py b/tests/integration_tests_hosting.py index 41e2eb9..b60f942 100644 --- a/tests/integration_tests_hosting.py +++ b/tests/integration_tests_hosting.py @@ -14,7 +14,7 @@ class HostingIntegrationTests(InstanceMixin, IntegrationTest): def test_create_file(self): - hosting = self._create_hosting('created_xyz') + hosting = self._create_hosting('created-xyz') a_hosting_file = StringIO() a_hosting_file.write('h1 {color: #541231;}') a_hosting_file.seek(0) @@ -23,12 +23,12 @@ def test_create_file(self): self.assertEqual(hosting_file.path, 'styles/main.css') def test_set_default(self): - hosting = self._create_hosting('default_xyz') + hosting = self._create_hosting('default-xyz') hosting = hosting.set_default() self.assertTrue('default', hosting.is_default) def test_update_file(self): - hosting = self._create_hosting('update_xyz') + hosting = self._create_hosting('update-xyz') a_hosting_file = StringIO() a_hosting_file.write('h1 {color: #541231;}') a_hosting_file.seek(0) From 25cb5441fe86052ca750253a0523dfbe4abdfc02 Mon Sep 17 00:00:00 2001 From: Robert Kopaczewski Date: Tue, 15 Nov 2016 11:32:21 +0100 Subject: [PATCH 08/11] [release-v5.4.5] Version bump --- syncano/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syncano/__init__.py b/syncano/__init__.py index 77b9198..4b36939 100644 --- a/syncano/__init__.py +++ b/syncano/__init__.py @@ -2,7 +2,7 @@ import os __title__ = 'Syncano Python' -__version__ = '5.4.4' +__version__ = '5.4.5' __author__ = "Daniel Kopka, Michal Kobus and Sebastian Opalczynski" __credits__ = ["Daniel Kopka", "Michal Kobus", From 3247126f42a3b474bf4d99ed9e739feaf73812c1 Mon Sep 17 00:00:00 2001 From: Robert Kopaczewski Date: Thu, 17 Nov 2016 15:30:02 +0100 Subject: [PATCH 09/11] Update manager.py --- syncano/models/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syncano/models/manager.py b/syncano/models/manager.py index c6ab313..61e7ae2 100644 --- a/syncano/models/manager.py +++ b/syncano/models/manager.py @@ -882,7 +882,7 @@ class for :class:`~syncano.models.base.Object` model. LOOKUP_SEPARATOR = '__' ALLOWED_LOOKUPS = [ 'gt', 'gte', 'lt', 'lte', - 'eq', 'neq', 'exists', 'in', + 'eq', 'neq', 'exists', 'in', 'nin', 'near', 'is', 'contains', 'startswith', 'endswith', 'contains', 'istartswith', From 39d1257e8e61acdf60280da7ff42d2d16f45baac Mon Sep 17 00:00:00 2001 From: Robert Kopaczewski Date: Thu, 17 Nov 2016 15:33:55 +0100 Subject: [PATCH 10/11] [added_nin] version bump --- syncano/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syncano/__init__.py b/syncano/__init__.py index 4b36939..760e46c 100644 --- a/syncano/__init__.py +++ b/syncano/__init__.py @@ -2,7 +2,7 @@ import os __title__ = 'Syncano Python' -__version__ = '5.4.5' +__version__ = '5.4.6' __author__ = "Daniel Kopka, Michal Kobus and Sebastian Opalczynski" __credits__ = ["Daniel Kopka", "Michal Kobus", From 5e2de8594598517f13000b1aab5b421f52bb0797 Mon Sep 17 00:00:00 2001 From: Robert Kopaczewski Date: Thu, 17 Nov 2016 15:39:30 +0100 Subject: [PATCH 11/11] [added_nin] Updated authors --- syncano/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/syncano/__init__.py b/syncano/__init__.py index 760e46c..a50f4be 100644 --- a/syncano/__init__.py +++ b/syncano/__init__.py @@ -6,8 +6,9 @@ __author__ = "Daniel Kopka, Michal Kobus and Sebastian Opalczynski" __credits__ = ["Daniel Kopka", "Michal Kobus", - "Sebastian Opalczynski"] -__copyright__ = 'Copyright 2015 Syncano' + "Sebastian Opalczynski", + "Robert Kopaczewski"] +__copyright__ = 'Copyright 2016 Syncano' __license__ = 'MIT' env_loglevel = os.getenv('SYNCANO_LOGLEVEL', 'INFO')