Beispiel #1
0
 def test_inside_doubledollar(self):
     fg = FuzzyGenerator(
             "GET http://localhost/$['aaa\$b', 'b\$ccc']$ HTTP/1.0", "")
     self.assertEqual(list(fg.generate()), [
         ("GET http://localhost/aaa$b HTTP/1.0", ""),
         ("GET http://localhost/b$ccc HTTP/1.0", ""),
                         ])
Beispiel #2
0
    def test_quant_gen_gen(self):
        fg = FuzzyGenerator("$range(2)$ dnd$'as'$", "pp")
        self.assertEqual(fg.calculateQuantity(), 4)

        self.assertEqual(list(fg.generate()), [
            ('0 dnda', 'pp'), ('0 dnds', 'pp'),
            ('1 dnda', 'pp'), ('1 dnds', 'pp')])
Beispiel #3
0
    def test_generations(self):
        fg = FuzzyGenerator("$range(2)$ dnd$'as'$", "pp")
        self.assertEqual(list(fg.generate()), [
            ('0 dnda', 'pp'), ('0 dnds', 'pp'),
            ('1 dnda', 'pp'), ('1 dnds', 'pp')])

        fg = FuzzyGenerator("$range(2)$ d$'as'$", "p$string.lowercase[:2]$")
        self.assertEqual(list(fg.generate()), [
            ('0 da', 'pa'), ('0 da', 'pb'), ('0 ds', 'pa'), ('0 ds', 'pb'),
            ('1 da', 'pa'), ('1 da', 'pb'), ('1 ds', 'pa'), ('1 ds', 'pb'),
        ])
Beispiel #4
0
 def test_double_token_together(self):
     # from bug 2393362, the idea is to generate 00 to 99
     # using to generators (I'm doing less iterations here)
     fg = FuzzyGenerator("-$xrange(2)$$xrange(2)$-", "")
     self.assertEqual(list(fg.generate()), [
         ("-00-", ""), ("-01-", ""), ("-10-", ""), ("-11-", "") ])
Beispiel #5
0
    def test_quantities(self):
        fg = FuzzyGenerator("$range(2)$ dnd$'as'$", "pp")
        self.assertEqual(fg.calculateQuantity(), 4)

        fg = FuzzyGenerator("$range(2)$ n$'as'$", "p$string.lowercase[:2]$")
        self.assertEqual(fg.calculateQuantity(), 8)