示例#1
0
    def test_get_subdomains_empty_no_file(self):
        subdomain_filename = None
        subdomains = []

        result = fierce.get_subdomains(subdomains, subdomain_filename)

        expected = subdomains
        self.assertEqual(expected, result)
示例#2
0
    def test_get_subdomains_multiple_subdomains_no_file(self):
        subdomain_filename = None
        subdomains = ['192.168.1.1', '192.168.1.2']

        result = fierce.get_subdomains(subdomains, subdomain_filename)

        expected = subdomains
        self.assertEqual(expected, result)
示例#3
0
    def test_get_subdomains_single_subdomain_no_file(self):
        subdomain_filename = None
        subdomains = ['subdomain.domain.com']

        result = fierce.get_subdomains(subdomains, subdomain_filename)

        expected = subdomains
        self.assertEqual(expected, result)
示例#4
0
    def test_get_subdomains_multiple_subdomains_no_file(self):
        subdomain_filename = None
        subdomains = ['192.168.1.1', '192.168.1.2']

        result = fierce.get_subdomains(
            subdomains,
            subdomain_filename
        )

        expected = subdomains
        self.assertEqual(expected, result)
示例#5
0
    def test_get_subdomains_single_subdomain_no_file(self):
        subdomain_filename = None
        subdomains = ['subdomain.domain.com']

        result = fierce.get_subdomains(
            subdomains,
            subdomain_filename
        )

        expected = subdomains
        self.assertEqual(expected, result)
示例#6
0
    def test_get_subdomains_empty_no_file(self):
        subdomain_filename = None
        subdomains = []

        result = fierce.get_subdomains(
            subdomains,
            subdomain_filename
        )

        expected = subdomains
        self.assertEqual(expected, result)
示例#7
0
    def test_get_subdomains_prefer_subdomains_over_file(self):
        subdomain_filename = os.path.join("directory", "subdomains")
        subdomains = ['192.168.1.1', '192.168.1.2']
        contents = textwrap.dedent("""
        sd1.domain.com
        sd2.domain.com
        sd3.domain.com
        """.strip())

        self.fs.CreateFile(subdomain_filename, contents=contents)

        result = fierce.get_subdomains(subdomains, subdomain_filename)

        expected = subdomains
        self.assertEqual(expected, result)
示例#8
0
    def test_get_subdomains_no_subdomains_use_file(self):
        subdomain_filename = os.path.join("directory", "subdomains")
        subdomains = []
        contents = textwrap.dedent("""
        sd1.domain.com
        sd2.domain.com
        sd3.domain.com
        """.strip())

        self.fs.CreateFile(subdomain_filename, contents=contents)

        result = fierce.get_subdomains(subdomains, subdomain_filename)

        expected = contents.split()
        self.assertEqual(expected, result)
示例#9
0
    def test_get_subdomains_prefer_subdomains_over_file(self):
        subdomain_filename = os.path.join("directory", "subdomains")
        subdomains = ['192.168.1.1', '192.168.1.2']
        contents = textwrap.dedent("""
        sd1.domain.com
        sd2.domain.com
        sd3.domain.com
        """.strip())

        self.fs.create_file(
            subdomain_filename,
            contents=contents
        )

        result = fierce.get_subdomains(
            subdomains,
            subdomain_filename
        )

        expected = subdomains
        self.assertEqual(expected, result)
示例#10
0
    def test_get_subdomains_no_subdomains_use_file(self):
        subdomain_filename = os.path.join("directory", "subdomains")
        subdomains = []
        contents = textwrap.dedent("""
        sd1.domain.com
        sd2.domain.com
        sd3.domain.com
        """.strip())

        self.fs.create_file(
            subdomain_filename,
            contents=contents
        )

        result = fierce.get_subdomains(
            subdomains,
            subdomain_filename
        )

        expected = contents.split()
        self.assertEqual(expected, result)