Skip to content

Commit

Permalink
Remove unused methods that have been replaced with JSON RPC calls
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Nov 7, 2018
1 parent 9eaf709 commit 91fcf22
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 72 deletions.
3 changes: 0 additions & 3 deletions tcms/core/ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ def categories(self):
def components(self):
return Component.objects.filter(product__id=self.product_id)

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


def tags(request):
"""
Expand Down
21 changes: 0 additions & 21 deletions tcms/core/tests/test_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from tcms.tests.factories import ComponentFactory
from tcms.tests.factories import ProductFactory
from tcms.tests.factories import UserFactory
from tcms.tests.factories import VersionFactory

from tcms.utils.permissions import initiate_user_with_default_setups

Expand All @@ -39,16 +38,6 @@ def setUpTestData(cls):

cls.categories = [cls.default_category, cls.category_one, cls.category_two]

def test_lowercase_string_is_converted_to_bool(self):
url = "%s?info_type=versions&product_id=1&is_active=true" % reverse('ajax-info')
response = self.client.get(url)
self.assertEqual(200, response.status_code)

def test_empty_string_is_converted_to_bool(self):
url = "%s?info_type=versions&product_id=1&is_active=" % reverse('ajax-info')
response = self.client.get(url)
self.assertEqual(200, response.status_code)

def test_with_unrecognisable_info_type(self):
""" When a request comes with invalid info_type,
we expect to receive response containing the 'Unrecognizable info-type' error message
Expand Down Expand Up @@ -95,9 +84,6 @@ def setUpTestData(cls):
cls.user_one = UserFactory()
cls.user_two = UserFactory()

cls.version_one = VersionFactory(product=cls.product)
cls.version_two = VersionFactory()

def test_categories(self):

categories = self.info_objects.categories()
Expand All @@ -123,13 +109,6 @@ def test_users(self):
self.assertIn(self.user_one, users)
self.assertNotIn(self.user_two, users)

def test_version(self):

test_versions = self.info_objects.versions()

self.assertIn(self.version_one, test_versions)
self.assertNotIn(self.version_two, test_versions)


class Test_TestCaseUpdates(BasePlanCase):
"""
Expand Down
48 changes: 0 additions & 48 deletions tcms/static/js/tcms_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,41 +266,6 @@ function set_up_choices(element, values, allow_blank) {
element.innerHTML = innerHTML;
}

function getVersionsByProductId(allow_blank, product_field, version_field) {
var product_field = jQ('#id_product')[0];

if (!version_field) {
if (jQ('#id_product_version').length) {
var version_field = jQ('#id_product_version')[0];
} else {
window.alert('Version field does not exist');
return false;
}
}

product_id = jQ(product_field).val();

if (product_id == "" && allow_blank) {
jQ(version_field).html('<option value="">---------</option>');
return true;
}

var success = function(t) {
returnobj = jQ.parseJSON(t.responseText);

set_up_choices(
version_field,
returnobj.map(function(o) {
return [o.pk, o.fields.value];
}),
allow_blank
);
};

getInfo({'info_type': 'versions', 'product_id': product_id},
success);
}

function getComponentsByProductId(allow_blank, product_field, component_field, callback, parameters) {
if (!parameters) {
var parameters = {};
Expand Down Expand Up @@ -399,19 +364,6 @@ function checkProductField(product_field) {
return false;
}

function bind_version_selector_to_product(allow_blank, load, product_field, version_field) {
var product_field = checkProductField(product_field);

if (product_field) {
jQ(product_field).bind('change', function() {
getVersionsByProductId(allow_blank, product_field, version_field);
});
if (load) {
getVersionsByProductId(allow_blank, product_field, version_field);
}
}
}

function bind_category_selector_to_product(allow_blank, load, product_field, category_field) {
var product_field = checkProductField(product_field);

Expand Down

0 comments on commit 91fcf22

Please sign in to comment.