Exemple #1
0
 def test_wildcard_matches(self):
     entry = blacklistEntry()
     entry.setTestField('NMBR = 002')
     entry.setDate('060606')
     entry.setComment('')
     entry2 = blacklistEntry()
     entry2.setTestField('0020030040')
     self.assertEquals(entry, entry2)
     self.assertEquals(entry2, entry)
 def test_wildcard_matches(self):
     entry = blacklistEntry()
     entry.setTestField('NMBR = 002')
     entry.setDate('060606')
     entry.setComment('')
     entry2 = blacklistEntry()
     entry2.setTestField('0020030040')
     self.assertEquals(entry, entry2)
     self.assertEquals(entry2, entry)
 def test_keeps_dashes(self):
     entry = blacklistEntry()
     entry.fromString('Salt Lake Ci UT?   ------        1-888-555-1212')
     self.assertEquals(entry.test, 'Salt Lake Ci UT?   ')
     self.assertEquals(entry.date, '------        ')
     self.assertEquals(entry.comment, '1-888-555-1212      ')
     self.assertEquals(entry.getValue(),
                       'Salt Lake Ci UT?   ------        1-888-555-1212      ')
     self.assertEquals(entry.getKey(), 'Salt Lake Ci UT?   ')
Exemple #4
0
 def test_keeps_dashes(self):
     entry = blacklistEntry()
     entry.fromString('Salt Lake Ci UT?   ------        1-888-555-1212')
     self.assertEquals(entry.test, 'Salt Lake Ci UT?   ')
     self.assertEquals(entry.date, '------        ')
     self.assertEquals(entry.comment, '1-888-555-1212      ')
     self.assertEquals(
         entry.getValue(),
         'Salt Lake Ci UT?   ------        1-888-555-1212      ')
     self.assertEquals(entry.getKey(), 'Salt Lake Ci UT?   ')
    def given_an_entry(self):
        self.entry = blacklistEntry()
        self.assertTrue(len(self.entry.test) == 19)
        self.assertEquals(self.entry.test, '                   ')

        self.entry.fromString('Salt Lake Ci UT?   062013        1-888-555-1212')
        self.assertEquals(self.entry.test, 'Salt Lake Ci UT?   ')
        self.assertEquals(self.entry.date, '062013        ')
        self.assertEquals(self.entry.comment, '1-888-555-1212      ')
        self.assertEquals(len(self.entry.comment), 20)

        self.assertEquals(self.entry.getKey(), 'Salt Lake Ci UT?   ')
Exemple #6
0
    def given_an_entry(self):
        self.entry = blacklistEntry()
        self.assertTrue(len(self.entry.test) == 19)
        self.assertEquals(self.entry.test, '                   ')

        self.entry.fromString(
            'Salt Lake Ci UT?   062013        1-888-555-1212')
        self.assertEquals(self.entry.test, 'Salt Lake Ci UT?   ')
        self.assertEquals(self.entry.date, '062013        ')
        self.assertEquals(self.entry.comment, '1-888-555-1212      ')
        self.assertEquals(len(self.entry.comment), 20)

        self.assertEquals(self.entry.getKey(), 'Salt Lake Ci UT?   ')
    def test_merge_eliminates_duplicates(self):
        lines=[
'#                  | <---- the 20th column',
'#Tested field:     Date field:   Comment field:',
'SELLING MY SOUL?   123456        1-888-555-1212',
'SELLING MY SOUL?   123456        different',
'SELLING MY SOUL?   123457        1-888-555-1212',
        ]
        it = blacklist()
        it.load(lines)
        self.assertEquals(1, len(it.dict))
        newentry = blacklistEntry()
        newentry.fromString('SELLING MY SOUL?   123456        Auto')
        it.merge([ newentry ])
        self.assertEquals(1, len(it.dict))
 def test_merge_eliminates_duplicates(self):
     lines = [
         '#                  | <---- the 20th column',
         '#Tested field:     Date field:   Comment field:',
         'SELLING MY SOUL?   123456        1-888-555-1212',
         'SELLING MY SOUL?   123456        different',
         'SELLING MY SOUL?   123457        1-888-555-1212',
     ]
     it = blacklist()
     it.load(lines)
     self.assertEquals(1, len(it.dict))
     newentry = blacklistEntry()
     newentry.fromString('SELLING MY SOUL?   123456        Auto')
     it.merge([newentry])
     self.assertEquals(1, len(it.dict))
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program.  If not, see <http://www.gnu.org/licenses/>.

# Blanket ban of all area codes we don't approve. Codes written to stdout.
# good list: where we live plus general purpose area codes.
from lib.blacklistentry import blacklistEntry

goodcodes = [ 281, 341, 315, 369, 385, 408, 415, 510, 503, 627, 628, 650, 669, 737, 764,
              800, 801, 818, 822, 833, 844, 855, 866, 877, 888, 916 ]

for i in range(0,1000):
    if i not in goodcodes:
        entry = blacklistEntry()
        entry.setTestField('NMBR = %03d' % i)
        entry.setDate('032510')
        entry.setComment('IGNORING')
        print entry

        #print "NMBR = %03d?        032510        BAD AREA CODE" % i

 def test_equals(self):
     entry = blacklistEntry()
     entry.setTestField('0020030040')
     entry2 = blacklistEntry()
     entry2.setTestField('0020030040')
     self.assertEquals(entry, entry2)
 def test_wildcard_created(self):
     entry = blacklistEntry()
     entry.setTestField('NMBR = 002')
     entry.setDate('060606')
     entry.setComment('')
     self.assertEquals(entry.getKey(), 'NMBR = 002?        ')
 def test_CreateFromScratch(self):
     entry = blacklistEntry()
     entry.setTestField('asdf')
     entry.setDate('060606')
     entry.setComment('')
     self.assertEquals(entry.getKey(), 'asdf?              ')
Exemple #13
0
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program.  If not, see <http://www.gnu.org/licenses/>.

# Blanket ban of all area codes we don't approve. Codes written to stdout.
# good list: where we live plus general purpose area codes.
from lib.blacklistentry import blacklistEntry

goodcodes = [
    281, 341, 315, 369, 385, 408, 415, 510, 503, 627, 628, 650, 669, 737, 764,
    800, 801, 818, 822, 833, 844, 855, 866, 877, 888, 916
]

for i in range(0, 1000):
    if i not in goodcodes:
        entry = blacklistEntry()
        entry.setTestField('NMBR = %03d' % i)
        entry.setDate('032510')
        entry.setComment('IGNORING')
        print entry

        #print "NMBR = %03d?        032510        BAD AREA CODE" % i
Exemple #14
0
 def test_equals(self):
     entry = blacklistEntry()
     entry.setTestField('0020030040')
     entry2 = blacklistEntry()
     entry2.setTestField('0020030040')
     self.assertEquals(entry, entry2)
Exemple #15
0
 def test_wildcard_created(self):
     entry = blacklistEntry()
     entry.setTestField('NMBR = 002')
     entry.setDate('060606')
     entry.setComment('')
     self.assertEquals(entry.getKey(), 'NMBR = 002?        ')
Exemple #16
0
 def test_CreateFromScratch(self):
     entry = blacklistEntry()
     entry.setTestField('asdf')
     entry.setDate('060606')
     entry.setComment('')
     self.assertEquals(entry.getKey(), 'asdf?              ')