Exemple #1
0
    def test_parse_args_basic(self):
        domain = 'example.com'

        args = fierce.parse_args([
            '--domain',
            domain,
        ])
        result = args.domain
        expected = domain

        self.assertEqual(expected, result)
Exemple #2
0
    def test_parse_args_custom_list_file(self):
        self.setUpPyfakefs()

        filename = os.path.join('test', 'custom.txt')
        self.fs.create_file(filename, contents='subdomain')

        args = fierce.parse_args([
            '--domain',
            'example.com',
            '--subdomain-file',
            filename,
        ])
        result = args.subdomain_file
        expected = filename
        exists = os.path.exists(result)

        self.assertEqual(expected, result)
        self.assertTrue(exists)
Exemple #3
0
    def test_parse_args_missing_list_file(self):
        filename = 'missing.txt'

        args = fierce.parse_args([
            '--domain',
            'example.com',
            '--subdomain-file',
            filename,
        ])
        result = args.subdomain_file
        expected = os.path.join(
            os.path.dirname(os.path.dirname(__file__)),
            'fierce',
            'lists',
            filename,
        )
        exists = os.path.exists(result)

        self.assertEqual(expected, result)
        self.assertFalse(exists)
Exemple #4
0
    def test_parse_args_included_list_file(self):
        filename = '5000.txt'

        args = fierce.parse_args([
            '--domain',
            'example.com',
            '--subdomain-file',
            filename,
        ])
        result = args.subdomain_file
        expected = os.path.join(
            os.path.dirname(os.path.dirname(__file__)),
            'fierce',
            'lists',
            filename,
        )
        exists = os.path.exists(result)

        assert expected == result
        assert exists