Skip to content

Commit

Permalink
Remove EnvGroup, EnvProperty and EnvValue models. Closes #484
Browse files Browse the repository at this point in the history
these are removed in favor of Tag
  • Loading branch information
atodorov committed Aug 21, 2018
1 parent d46dcb9 commit a659f98
Show file tree
Hide file tree
Showing 71 changed files with 139 additions and 2,965 deletions.
1 change: 0 additions & 1 deletion docs/source/modules/tcms.management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ Submodules
tcms.management.admin
tcms.management.forms
tcms.management.models
tcms.management.views

7 changes: 0 additions & 7 deletions docs/source/modules/tcms.management.views.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/source/modules/tcms.xmlrpc.api.env_group.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/source/modules/tcms.xmlrpc.api.env_property.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/source/modules/tcms.xmlrpc.api.env_value.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/source/modules/tcms.xmlrpc.api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ Submodules
tcms.xmlrpc.api.build
tcms.xmlrpc.api.category
tcms.xmlrpc.api.component
tcms.xmlrpc.api.env_group
tcms.xmlrpc.api.env_property
tcms.xmlrpc.api.env_value
tcms.xmlrpc.api.plantype
tcms.xmlrpc.api.priority
tcms.xmlrpc.api.product
Expand Down
13 changes: 0 additions & 13 deletions tcms/core/ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

from tcms.management.models import Component, Build, Version
from tcms.management.models import Tag
from tcms.management.models import EnvGroup, EnvProperty, EnvValue
from tcms.testcases.models import TestCase, Bug
from tcms.testcases.models import Category
from tcms.testcases.models import TestCaseTag
Expand Down Expand Up @@ -68,24 +67,12 @@ def categories(self):
def components(self):
return Component.objects.filter(product__id=self.product_id)

def env_properties(self):
if self.request.GET.get('env_group_id'):
return EnvGroup.objects.get(id=self.request.GET['env_group_id']).property.all()
return EnvProperty.objects.all()

def env_values(self):
return EnvValue.objects.filter(property_id=self.request.GET.get('env_property_id'))

def tags(self):
return Tag.objects.filter(name__startswith=self.request.GET['name__startswith'])

def versions(self):
return Version.objects.filter(product__id=self.product_id)

@staticmethod
def env_groups():
return EnvGroup.objects.all()


def tags(request):
""" Get tags for TestPlan, TestCase or TestRun """
Expand Down
46 changes: 0 additions & 46 deletions tcms/core/tests/test_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
from tcms.tests.factories import TestPlanFactory
from tcms.tests.factories import CategoryFactory
from tcms.tests.factories import ComponentFactory
from tcms.tests.factories import EnvGroupFactory
from tcms.tests.factories import EnvPropertyFactory
from tcms.tests.factories import EnvGroupPropertyMapFactory
from tcms.tests.factories import ProductFactory
from tcms.tests.factories import EnvValueFactory
from tcms.tests.factories import UserFactory
from tcms.tests.factories import VersionFactory
from tcms.tests.factories import BuildFactory
Expand Down Expand Up @@ -103,16 +99,6 @@ def setUpTestData(cls):
cls.component_two = ComponentFactory(product=cls.product)
cls.component_three = ComponentFactory()

cls.env_group_one = EnvGroupFactory()
cls.env_group_two = EnvGroupFactory()

cls.env_property_one = EnvPropertyFactory()
cls.env_property_two = EnvPropertyFactory()
EnvGroupPropertyMapFactory(group=cls.env_group_one, property=cls.env_property_one)

cls.env_value_one = EnvValueFactory(property=cls.env_property_one)
cls.env_value_two = EnvValueFactory()

cls.user_one = UserFactory()
cls.user_two = UserFactory()

Expand Down Expand Up @@ -153,38 +139,6 @@ def test_components(self):
self.assertIn(self.component_two, components)
self.assertNotIn(self.component_three, components)

def test_env_groups(self):

env_groups = self.info_objects.env_groups()

self.assertIn(self.env_group_one, env_groups)
self.assertIn(self.env_group_two, env_groups)

def test_env_properties(self):

env_properties = self.info_objects.env_properties()

self.assertIn(self.env_property_one, env_properties)
self.assertIn(self.env_property_two, env_properties)

def test_env_properties_by_env_group(self):
self.request.GET = {'env_group_id': self.env_group_one.pk}

info_objects = _InfoObjects(self.request)
env_properties = info_objects.env_properties()

self.assertIn(self.env_property_one, env_properties)
self.assertNotIn(self.env_property_two, env_properties)

def test_env_values(self):
self.request.GET = {'env_property_id': self.env_property_one.pk}

info_objects = _InfoObjects(self.request)
env_values = info_objects.env_values()

self.assertIn(self.env_value_one, env_values)
self.assertNotIn(self.env_value_two, env_values)

def test_users(self):
self.request.GET = {'username': self.user_one.username}

Expand Down
50 changes: 3 additions & 47 deletions tcms/core/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
# -*- coding: utf-8 -*-

import json
from http import HTTPStatus
from urllib.parse import urlencode

from django import test
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core import serializers
from django.urls import reverse
from django_comments.models import Comment

from tcms.management.models import Priority
from tcms.management.models import EnvGroup
from tcms.management.models import EnvProperty
from tcms.testcases.forms import TestCase
from tcms.testruns.models import TestCaseRun
from tcms.tests import BaseCaseRun
from tcms.tests import BasePlanCase
from tcms.tests import remove_perm_from_user
from tcms.tests import user_should_have_perm
from tcms.tests.factories import UserFactory
from tcms.tests.factories import EnvGroupFactory
from tcms.tests.factories import EnvGroupPropertyMapFactory
from tcms.tests.factories import EnvPropertyFactory


class TestNavigation(test.TestCase):
Expand Down Expand Up @@ -195,43 +188,6 @@ def setUpTestData(cls):

cls.get_info_url = reverse('ajax-info')

cls.group_nitrate = EnvGroupFactory(name='nitrate')
cls.group_new = EnvGroupFactory(name='NewGroup')

cls.property_os = EnvPropertyFactory(name='os')
cls.property_python = EnvPropertyFactory(name='python')
cls.property_django = EnvPropertyFactory(name='django')

EnvGroupPropertyMapFactory(group=cls.group_nitrate,
property=cls.property_os)
EnvGroupPropertyMapFactory(group=cls.group_nitrate,
property=cls.property_python)
EnvGroupPropertyMapFactory(group=cls.group_new,
property=cls.property_django)

def test_get_env_properties(self):
response = self.client.get(self.get_info_url, {'info_type': 'env_properties'})

expected_json = json.loads(
serializers.serialize(
'json',
EnvProperty.objects.all(),
fields=('name', 'value')))
self.assertJSONEqual(
str(response.content, encoding=settings.DEFAULT_CHARSET),
expected_json)

def test_get_env_properties_by_group(self):
response = self.client.get(self.get_info_url,
{'info_type': 'env_properties',
'env_group_id': self.group_new.pk})

group = EnvGroup.objects.get(pk=self.group_new.pk)
expected_json = json.loads(
serializers.serialize(
'json',
group.property.all(),
fields=('name', 'value')))
self.assertJSONEqual(
str(response.content, encoding=settings.DEFAULT_CHARSET),
expected_json)
def test_get_info(self):
# todo: must implement these tests
pass
22 changes: 0 additions & 22 deletions tcms/locale/de_DE/LC_MESSAGES/djangojs.po

This file was deleted.

23 changes: 0 additions & 23 deletions tcms/locale/en/LC_MESSAGES/djangojs.po

This file was deleted.

22 changes: 0 additions & 22 deletions tcms/locale/sl_SI/LC_MESSAGES/djangojs.po

This file was deleted.

22 changes: 0 additions & 22 deletions tcms/locale/zh_CN/LC_MESSAGES/djangojs.po

This file was deleted.

22 changes: 0 additions & 22 deletions tcms/locale/zh_TW/LC_MESSAGES/djangojs.po

This file was deleted.

47 changes: 47 additions & 0 deletions tcms/management/migrations/0013_remove_env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Generated by Django 2.1 on 2018-08-21 13:58

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('testruns', '0017_remove_env'),
('testplans', '0018_remove_env'),
('management', '0012_remove_user_fks_from_envgroup'),
]

operations = [
migrations.RemoveField(
model_name='envgroup',
name='property',
),
migrations.RemoveField(
model_name='envgrouppropertymap',
name='group',
),
migrations.RemoveField(
model_name='envgrouppropertymap',
name='property',
),
migrations.AlterUniqueTogether(
name='envvalue',
unique_together=set(),
),
migrations.RemoveField(
model_name='envvalue',
name='property',
),
migrations.DeleteModel(
name='EnvGroup',
),
migrations.DeleteModel(
name='EnvGroupPropertyMap',
),
migrations.DeleteModel(
name='EnvProperty',
),
migrations.DeleteModel(
name='EnvValue',
),
]
Loading

0 comments on commit a659f98

Please sign in to comment.