Commit 30e3c4d7 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Drop unused script

   Old script not used anywhere
parent 25ff6c76
compute_node = context
now_date = DateTime()
if (now_date - compute_node.getCreationDate()) < maximum_days:
# This compute_node was created recently skip
return True
message_dict = context.getAccessStatus()
# Ignore if data isn't present.
if message_dict.get("no_data", None) == 1:
message_dict = {}
if 'created_at' in message_dict:
contact_date = DateTime(message_dict.get('created_at').encode('utf-8'))
return (now_date - contact_date) < maximum_days
return False
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>maximum_days=30</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputeNode_hasContactedRecently</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -162,44 +162,6 @@ class TestSlapOSSupportRequestModule_getMonitoringUrlList(TestCRMSkinsMixin): ...@@ -162,44 +162,6 @@ class TestSlapOSSupportRequestModule_getMonitoringUrlList(TestCRMSkinsMixin):
self.tic() self.tic()
self.assertNotEqual(instance_tree.getSuccessorList(), []) self.assertNotEqual(instance_tree.getSuccessorList(), [])
class TestComputeNode_hasContactedRecently(SlapOSTestCaseMixinWithAbort):
def test_ComputeNode_hasContactedRecently_newly_created(self):
compute_node, _ = self._makeComputeNode(self.addProject())
self.tic()
has_contacted = compute_node.ComputeNode_hasContactedRecently()
self.assertTrue(has_contacted)
def test_ComputeNode_hasContactedRecently_no_data(self):
with PinnedDateTime(self, DateTime()-32):
compute_node, _ = self._makeComputeNode(self.addProject())
self.tic()
has_contacted = compute_node.ComputeNode_hasContactedRecently()
self.assertFalse(has_contacted)
def test_ComputeNode_hasContactedRecently_memcached(self):
with PinnedDateTime(self, DateTime()-32):
compute_node, _ = self._makeComputeNode(self.addProject())
compute_node.setAccessStatus("")
self.tic()
has_contacted = compute_node.ComputeNode_hasContactedRecently()
self.assertTrue(has_contacted)
def test_ComputeNode_hasContactedRecently_memcached_oudated_no_spl(self):
with PinnedDateTime(self, DateTime()-32):
compute_node, _ = self._makeComputeNode(self.addProject())
compute_node.setAccessStatus("")
self.tic()
has_contacted = compute_node.ComputeNode_hasContactedRecently()
self.assertFalse(has_contacted)
class TestSlapOSisSupportRequestCreationClosed(TestCRMSkinsMixin): class TestSlapOSisSupportRequestCreationClosed(TestCRMSkinsMixin):
def afterSetUp(self): def afterSetUp(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment