aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdan Binshtok <eb578m@intl.att.com>2017-10-18 08:11:04 +0300
committerAreli Fuss <af732p@att.com>2017-10-18 16:20:46 +0300
commit66b6b62367bc63858345fcef969015b44836511c (patch)
tree666ca48b41bf50878750de540b0a1a9451e9804e
parentedecc0a9872c712d0796037c21409efa8e37cd71 (diff)
Revert POM file
Revert the POM file merge changes Change-Id: I7d726b6212917b3a123a545fd732eadaf7a108ad Issue-Id: VVP-25 Signed-off-by: Areli Fuss <af732p@att.com>
l---------django/cms/settings/__init__.py8
-rw-r--r--django/cms/tests/__init__.py0
-rw-r--r--django/cms/tests/test_base_entity.py68
-rw-r--r--django/cms/tests/test_import_cetgories_command.py76
-rw-r--r--django/cms/tests/test_import_pages_command.py60
-rw-r--r--django/cms/tests/test_page_service.py106
-rw-r--r--django/requirements.txt1
-rw-r--r--pom.xml5
8 files changed, 316 insertions, 8 deletions
diff --git a/django/cms/settings/__init__.py b/django/cms/settings/__init__.py
index df52f04..0e19472 120000
--- a/django/cms/settings/__init__.py
+++ b/django/cms/settings/__init__.py
@@ -1,7 +1 @@
-# Settings file for VVP CMS
-#
-# You should arrange to overwrite this file,
-# with one containing settings for your environment.
-#
-# In Kubernetes, for example, this means mount a configMap,
-# volume to /srv/settings containing, settings in the file __init__.py.
+/opt/configmaps/settings/__init__.py \ No newline at end of file
diff --git a/django/cms/tests/__init__.py b/django/cms/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/django/cms/tests/__init__.py
diff --git a/django/cms/tests/test_base_entity.py b/django/cms/tests/test_base_entity.py
new file mode 100644
index 0000000..028ec3b
--- /dev/null
+++ b/django/cms/tests/test_base_entity.py
@@ -0,0 +1,68 @@
+#
+# ============LICENSE_START==========================================
+# org.onap.vvp/engagementmgr
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+from abc import ABCMeta, abstractmethod
+import http.client
+import django
+from django.test import TestCase
+from django.test.client import Client
+django.setup()
+
+
+class TestBaseEntity(TestCase):
+ __metaclass__ = ABCMeta
+
+ def setUp(self):
+ self.urlPrefix = "/api/"
+ self.conn = http.client.HTTPConnection("127.0.0.1", 8000)
+ self.c = Client()
+ self.childSetup()
+
+ def tearDown(self):
+ self.conn.close()
+
+ @abstractmethod
+ def childSetup(self):
+ pass
+
+ def console_print(self, msg):
+ print("======================= "
+ "log from test "
+ "=======================")
+ print(msg)
+ print("_____________________________________________________________")
diff --git a/django/cms/tests/test_import_cetgories_command.py b/django/cms/tests/test_import_cetgories_command.py
new file mode 100644
index 0000000..676286e
--- /dev/null
+++ b/django/cms/tests/test_import_cetgories_command.py
@@ -0,0 +1,76 @@
+#
+# ============LICENSE_START==========================================
+# org.onap.vvp/engagementmgr
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+from mezzanine.blog.models import BlogCategory
+from cms.management.commands import import_categories
+from cms.tests.test_base_entity import TestBaseEntity
+
+
+class ImportCategoriesCommandTestCase(TestBaseEntity):
+
+ def childSetup(self):
+ print("======================= "
+ "ImportCategoriesCommandTestCase "
+ "=======================")
+ import_categories_command = import_categories.Command()
+ import_categories_command.handle()
+ self.console_print("command ran successfully")
+
+ def testNewsCategoryCreatedByCommand(self):
+ news_title = "News"
+ news_category = \
+ BlogCategory.objects.get(title=news_title)
+
+ self.assertTrue(news_category is not None)
+ self.assertEqual(news_category.title, news_title)
+
+ def testAnnouncementCategoryCreatedByCommand(self):
+ announcement_title = "Announcement"
+ announcement_category = \
+ BlogCategory.objects.get(title=announcement_title)
+
+ self.assertTrue(announcement_category is not None)
+ self.assertEqual(announcement_category.title, announcement_title)
+
+ def testFAQCategoryCreatedByCommand(self):
+ faq_title = "FAQ"
+ faq_category = \
+ BlogCategory.objects.get(title=faq_title)
+
+ self.assertTrue(faq_category is not None)
+ self.assertEqual(faq_category.title, faq_title)
diff --git a/django/cms/tests/test_import_pages_command.py b/django/cms/tests/test_import_pages_command.py
new file mode 100644
index 0000000..02ce91a
--- /dev/null
+++ b/django/cms/tests/test_import_pages_command.py
@@ -0,0 +1,60 @@
+#
+# ============LICENSE_START==========================================
+# org.onap.vvp/engagementmgr
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+from mezzanine.pages.models import RichTextPage
+from cms.management.commands import import_pages
+from cms.tests.test_base_entity import TestBaseEntity
+
+
+class ImportPagesCommandTestCase(TestBaseEntity):
+
+ def childSetup(self):
+ print("======================= "
+ "ImportPagesCommandTestCase "
+ "=======================")
+ import_pages_command = import_pages.Command()
+ import_pages_command.handle()
+ self.console_print("command ran successfully")
+
+ def testDocumentationPageCreatedByCommand(self):
+ documentation_title = "Documentation"
+ documentation_page = \
+ RichTextPage.objects.get(title=documentation_title)
+
+ self.assertTrue(documentation_page is not None)
+ self.assertEqual(documentation_page.title, documentation_title)
diff --git a/django/cms/tests/test_page_service.py b/django/cms/tests/test_page_service.py
new file mode 100644
index 0000000..bc64036
--- /dev/null
+++ b/django/cms/tests/test_page_service.py
@@ -0,0 +1,106 @@
+#
+# ============LICENSE_START==========================================
+# org.onap.vvp/engagementmgr
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import json
+
+from mezzanine.pages.models import RichTextPage
+
+from cms.management.commands import import_pages
+from cms.tests.test_base_entity import TestBaseEntity
+
+
+class PageServiceTestCase(TestBaseEntity):
+
+ def childSetup(self):
+ print("======================= "
+ "PageServiceTestCase "
+ "=======================")
+ import_pages_command = import_pages.Command()
+ import_pages_command.handle()
+
+ self.documentation_page = \
+ RichTextPage.objects.get(title="Documentation")
+ self.base_page_content = "baseContentOfPage"
+ self.base_page_title = "baseTitle"
+ self.search_url = self.urlPrefix + 'pages/search/?keyword={keyword}'
+
+ page = RichTextPage.objects.get_or_create(
+ title=self.base_page_title,
+ defaults={
+ 'content': self.base_page_content,
+ 'login_required': False}
+ )
+ print("Created basic page under documentation page:%s" % page[0].title)
+
+ def testSearchPageByContent(self):
+ response = self.c.get(self.search_url
+ .format(keyword=self.base_page_content))
+
+ self.assertEqual(response.status_code, 200)
+ self.console_print("Got 200 status from server, page search success")
+ content = json.loads(response.content)
+
+ self.assertEqual(len(content), 1)
+ self.console_print("There is exactly one page that answers this query")
+ self.assertEqual(content[0]['title'], self.base_page_title)
+ self.console_print("The page is the requested one, test pass")
+
+ def testSearchPageByTitle(self):
+ response = self.c.get(self.search_url
+ .format(keyword=self.base_page_title))
+
+ self.assertEqual(response.status_code, 200)
+ self.console_print("Got 200 status from server, page search success")
+ content = json.loads(response.content)
+
+ self.assertEqual(len(content), 1)
+ self.console_print("There is exactly one page that answers this query")
+ self.assertEqual(content[0]['title'], self.base_page_title)
+ self.console_print("The page is the requested one, test pass")
+
+ def testSearchNotExistedPage(self):
+ response = self.c.get(self.search_url
+ .format(keyword="pageNotExists"))
+
+ self.assertEqual(response.status_code, 200)
+ self.console_print("Got 200 status from server, page search success")
+ content = json.loads(response.content)
+
+ self.assertEqual(len(content), 0)
+ self.console_print("There is no page that answers this query, "
+ "test pass")
diff --git a/django/requirements.txt b/django/requirements.txt
index 8a00ac1..872b253 100644
--- a/django/requirements.txt
+++ b/django/requirements.txt
@@ -36,6 +36,7 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
Django==1.10.6
+djangorestframework==3.6.4
Mezzanine==4.2.3
git+https://github.com/att-innovate/mezzanine-api.git@master
psycopg2
diff --git a/pom.xml b/pom.xml
index a00b1a0..ed867de 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,7 +40,7 @@
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
- <version>0.19.1</version>
+ <version>0.15.1</version>
<configuration>
<verbose>true</verbose>
<apiVersion>1.23</apiVersion>
@@ -120,3 +120,6 @@
</repositories>
</project>
+
+
+