HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.  2.0.0-chaika
Hierarchical Cluster Engine Python language binding
ftests.ftest_Filters.Test Class Reference
Inheritance diagram for ftests.ftest_Filters.Test:
Collaboration diagram for ftests.ftest_Filters.Test:

Public Member Functions

def setUp (self)
 
def tearDown (self)
 
def execCommand (self, command, step)
 
def commonAssert_01 (self, localFilters)
 
def commonAssert_02 (self, localFilters)
 
def commonAssert_03 (self, localFilters)
 
def commonAssert_04 (self, localFilters)
 
def test_01 (self)
 
def test_02 (self)
 
def test_03 (self)
 
def test_04 (self)
 
def test_09 (self)
 

Static Public Attributes

string CFG_NAME = "../../ini/db-task.ini"
 
string CONST_SITE_ID = "65f5d740b25e73d4c63d9f06e8f15b90"
 

Detailed Description

Definition at line 39 of file ftest_Filters.py.

Member Function Documentation

◆ commonAssert_01()

def ftests.ftest_Filters.Test.commonAssert_01 (   self,
  localFilters 
)

Definition at line 71 of file ftest_Filters.py.

71  def commonAssert_01(self, localFilters):
72  value = {"ContentType": "text/xml", "url": "text/xml", "MDd5" : "test/xml"}
73 
74  result = localFilters.filterAll(Filters.STAGE_AFTER_DOM, value, Filters.LOGIC_AND)
75  self.assertTrue(result == [True], ">>> Test01_A BAD")
76  result = localFilters.filterAll(Filters.STAGE_AFTER_DOM, value, Filters.LOGIC_OR)
77  self.assertTrue(result == [2], ">>> Test01_B BAD")
78 
79 
Here is the caller graph for this function:

◆ commonAssert_02()

def ftests.ftest_Filters.Test.commonAssert_02 (   self,
  localFilters 
)

Definition at line 80 of file ftest_Filters.py.

80  def commonAssert_02(self, localFilters):
81  value = {"ContentType": "application/dat", "url": "text/xml", "MDd5" : "test/xml"}
82 
83  result = localFilters.filterAll(Filters.STAGE_AFTER_DOM_PRE, value, Filters.LOGIC_AND)
84  self.assertTrue(result == [], ">>> Test02_A BAD")
85  result = localFilters.filterAll(Filters.STAGE_AFTER_DOM_PRE, value, Filters.LOGIC_OR)
86  self.assertTrue(result == [], ">>> Test02_B BAD")
87 
88 
Here is the caller graph for this function:

◆ commonAssert_03()

def ftests.ftest_Filters.Test.commonAssert_03 (   self,
  localFilters 
)

Definition at line 89 of file ftest_Filters.py.

89  def commonAssert_03(self, localFilters):
90  value = {"ContentType": "text/xml", "url": "text/xml", "MDd5" : "test/xml"}
91 
92  result = localFilters.filterAll(Filters.STAGE_BEFORE_DOM_PRE, value, Filters.LOGIC_AND)
93  self.assertTrue(result == [False], ">>> Test03_A BAD")
94  result = localFilters.filterAll(Filters.STAGE_BEFORE_DOM_PRE, value, Filters.LOGIC_OR)
95  self.assertTrue(result == [1, -4, 5, 6], ">>> Test03_B BAD")
96 
97  result = localFilters.filterAll(Filters.STAGE_COLLECT_URLS, value, Filters.LOGIC_AND)
98  self.assertTrue(result == [], ">>> Test03_C BAD")
99  result = localFilters.filterAll(Filters.STAGE_COLLECT_URLS, value, Filters.LOGIC_OR)
100  self.assertTrue(result == [], ">>> Test03_D BAD")
101 
102 
Here is the caller graph for this function:

◆ commonAssert_04()

def ftests.ftest_Filters.Test.commonAssert_04 (   self,
  localFilters 
)

Definition at line 103 of file ftest_Filters.py.

103  def commonAssert_04(self, localFilters):
104  value = {"ContentType": "text/html", "url": "text/xml", "ddl" : "test/xml"}
105 
106  result = localFilters.filterAll(Filters.STAGE_AFTER_PROCESSOR, value, Filters.LOGIC_AND)
107  self.assertTrue(result == [False], ">>> Test04_A BAD")
108  result = localFilters.filterAll(Filters.STAGE_AFTER_PROCESSOR, value, Filters.LOGIC_OR)
109  self.assertTrue(result == [3, -7, -8], ">>> Test04_B BAD")
110 
111 
Here is the caller graph for this function:

◆ execCommand()

def ftests.ftest_Filters.Test.execCommand (   self,
  command,
  step 
)

Definition at line 54 of file ftest_Filters.py.

54  def execCommand(self, command, step):
55  obj = None
56  print ">>> Start = " + str(command)
57  fd = os.popen(command)
58  if fd:
59  localStr = fd.read()
60  fd.close()
61  print ">>> Finish = " + str(command)
62  try:
63  obj = pickle.loads(localStr)
64  except EOFError:
65  self.assertTrue(False, "Step%s >>> Invalid return data" % str(step))
66  else:
67  print ">>> Bad FD " + + str(command)
68  return obj
69 
70 

◆ setUp()

def ftests.ftest_Filters.Test.setUp (   self)

Definition at line 44 of file ftest_Filters.py.

44  def setUp(self):
45  cfgParser = ConfigParser.ConfigParser()
46  cfgParser.read(self.CFG_NAME)
47  #self.wrapper = DBTasksWrapper.DBTasksWrapper(cfgParser)
48 
49 

◆ tearDown()

def ftests.ftest_Filters.Test.tearDown (   self)

Definition at line 50 of file ftest_Filters.py.

50  def tearDown(self):
51  pass
52 
53 

◆ test_01()

def ftests.ftest_Filters.Test.test_01 (   self)

Definition at line 112 of file ftest_Filters.py.

112  def test_01(self):
113  localFilters = Filters(filtersTmp1)
114  self.commonAssert_01(localFilters)
115 
Here is the call graph for this function:

◆ test_02()

def ftests.ftest_Filters.Test.test_02 (   self)

Definition at line 116 of file ftest_Filters.py.

116  def test_02(self):
117  localFilters = Filters(filtersTmp1)
118  self.commonAssert_02(localFilters)
119 
120 
Here is the call graph for this function:

◆ test_03()

def ftests.ftest_Filters.Test.test_03 (   self)

Definition at line 121 of file ftest_Filters.py.

121  def test_03(self):
122  localFilters = Filters(filtersTmp1)
123  self.commonAssert_03(localFilters)
124 
125 
Here is the call graph for this function:

◆ test_04()

def ftests.ftest_Filters.Test.test_04 (   self)

Definition at line 126 of file ftest_Filters.py.

126  def test_04(self):
127  localFilters = Filters(filtersTmp1)
128  self.commonAssert_04(localFilters)
129 
130 
Here is the call graph for this function:

◆ test_09()

def ftests.ftest_Filters.Test.test_09 (   self)

Definition at line 154 of file ftest_Filters.py.

154  def test_09(self):
155  localUrl = "http://pbn.com/Brown-and-URI-slip-Bryant-and-RIC-gain-in-2015-08-college-rankings,99822"
156  localFilters = [{"Pattern" : "http://pbn.com/(.*)-%CUR_YEAR_FULL%-%CUR_MONTH_FULL%(.*)", "Subject" : localUrl,
157  "OperationCode" : Filters.OC_RE, "Stage" : Filters.STAGE_AFTER_PROCESSOR, "Action" : 1},
158  {"Pattern" : "http://pbn.com/(.*)-%CUR_YEAR_FULL%-%CUR_MONTH_FULL%(.*)", "Subject" : localUrl,
159  "OperationCode" : Filters.OC_RE, "Stage" : Filters.STAGE_BEFORE_DOM_PRE, "Action" : 2},
160  {"Pattern" : "http://pbn.com/(.*)-%ANY_DATA%(.*)", "Subject" : localUrl,
161  "OperationCode" : Filters.OC_RE, "Stage" : Filters.STAGE_AFTER_PROCESSOR, "Action" : 3},
162  {"Pattern" : "%DEPTH%", "Subject" : "10",
163  "OperationCode" : Filters.OC_EQMORE, "Stage" : Filters.STAGE_AFTER_PROCESSOR, "Action" : 4},]
164  localFilters = Filters(localFilters)
165 
166  value = {"ContentType": "text/xml", "url": "text/xml", "CUR_YEAR_FULL": "2015", "CUR_MONTH_FULL": "08",
167  "DEPTH": "1"}
168 
169  result = localFilters.filterAll(Filters.STAGE_AFTER_PROCESSOR, value, Filters.LOGIC_OR)
170  print result
171 
172 

Member Data Documentation

◆ CFG_NAME

string ftests.ftest_Filters.Test.CFG_NAME = "../../ini/db-task.ini"
static

Definition at line 41 of file ftest_Filters.py.

◆ CONST_SITE_ID

string ftests.ftest_Filters.Test.CONST_SITE_ID = "65f5d740b25e73d4c63d9f06e8f15b90"
static

Definition at line 42 of file ftest_Filters.py.


The documentation for this class was generated from the following file: