Ejemplo n.º 1
0
    def test_parse_whois_status_when_missing(self):
        uri = {
            "domain": self.ANY_DOMAIN,
            "whois": {
                "raw": "",
                "servers": [self.ANY_WHOIS_SERVER]
            }
        }

        parse_whois(uri)

        self.assertEqual([], uri["status"])
Ejemplo n.º 2
0
    def test_parse_whois_registrar_when_missing(self):
        uri = {
            "domain": self.ANY_DOMAIN,
            "whois": {
                "raw": "",
                "servers": [self.ANY_WHOIS_SERVER]
            }
        }

        parse_whois(uri)

        self.assertEqual("", uri["registrar"])
Ejemplo n.º 3
0
    def test_parse_whois_available_registered_flags_when_no_match_for_domain(self):
        uri = {
            "domain": self.ANY_DOMAIN,
            "whois": {
                "raw": "No match for \"MYDOMAIN.NET\".",
                "servers": [self.ANY_WHOIS_SERVER]
            }
        }

        parse_whois(uri)

        self.assertTrue(uri["available"])
        self.assertFalse(uri["registered"])
Ejemplo n.º 4
0
    def test_parse_whois_available_registered_flags_when_status_is_not_empty(self):
        uri = {
            "domain": self.ANY_DOMAIN,
            "whois": {
                "raw": "Status: ok",
                "servers": [self.ANY_WHOIS_SERVER]
            }
        }

        parse_whois(uri)

        self.assertFalse(uri["available"])
        self.assertTrue(uri["registered"])
Ejemplo n.º 5
0
    def test_parse_whois_domain_id(self):
        uri = {
            "domain": self.ANY_DOMAIN,
            "whois": {
                "raw": "Domain Name: WIKIPEDIA.ORG\r\n"
                       "Registry Domain ID: D51687756-LROR\r\n",
                "servers": [self.ANY_WHOIS_SERVER]
            }
        }

        parse_whois(uri)

        self.assertEqual("D51687756-LROR", uri["domain_id"])
Ejemplo n.º 6
0
    def test_parse_whois_dates_when_missing(self):
        uri = {
            "domain": self.ANY_DOMAIN,
            "whois": {
                "raw": "",
                "servers": [self.ANY_WHOIS_SERVER]
            }
        }

        parse_whois(uri)

        self.assertTrue("create_time" not in uri)
        self.assertTrue("update_time" not in uri)
        self.assertTrue("expire_time" not in uri)
Ejemplo n.º 7
0
    def test_parse_whois_emails(self):
        uri = {
            "domain": self.ANY_DOMAIN,
            "whois": {
                "raw": "Registrar: MarkMonitor Inc.\r\n"
                       "Registrar IANA ID: 292\r\n"
                       "Registrar Abuse Contact Email: [email protected]\r\n"
                       "Registrar Abuse Contact Phone: +1.2083895740\r\n",
                "servers": [self.ANY_WHOIS_SERVER]
            }
        }

        parse_whois(uri)

        self.assertEqual(["*****@*****.**"], uri["whois"]["emails"])
Ejemplo n.º 8
0
    def test_parse_whois_contacts_when_missing(self):
        uri = {
            "domain": self.ANY_DOMAIN,
            "whois": {
                "raw": "",
                "servers": [self.ANY_WHOIS_SERVER]
            }
        }

        parse_whois(uri)

        self.assertEqual({}, uri["admin_contacts"])
        self.assertEqual({}, uri["billing_contacts"])
        self.assertEqual({}, uri["registrant_contacts"])
        self.assertEqual({}, uri["technical_contacts"])
Ejemplo n.º 9
0
    def test_parse_whois_registrar(self):
        uri = {
            "domain": self.ANY_DOMAIN,
            "whois": {
                "raw": "Registrar WHOIS Server: whois.markmonitor.com\r\n"
                       "Registrar URL: http://www.markmonitor.com\r\n"
                       "Registrar Registration Expiration Date:\r\n"
                       "Registrar: MarkMonitor Inc.\r\n"
                       "Registrar IANA ID: 292\r\n",
                "servers": [self.ANY_WHOIS_SERVER]
            }
        }

        parse_whois(uri)

        self.assertEqual("MarkMonitor Inc.", uri["registrar"])
Ejemplo n.º 10
0
    def test_parse_whois_dates(self):
        uri = {
            "domain": self.ANY_DOMAIN,
            "whois": {
                "raw": "Updated Date: 2015-12-12T10:16:19Z\r\n"
                       "Creation Date: 2001-01-13T00:12:14Z\r\n"
                       "Registry Expiry Date: 2023-01-13T00:12:14Z\r\n"
                       "Registrar Registration Expiration Date:\r\n",
                "servers": [self.ANY_WHOIS_SERVER]
            }
        }

        parse_whois(uri)

        self.assertEqual("2001-01-13 00:12:14", str(uri["create_time"]))
        self.assertEqual("2015-12-12 10:16:19", str(uri["update_time"]))
        self.assertEqual("2023-01-13 00:12:14", str(uri["expire_time"]))
Ejemplo n.º 11
0
    def test_parse_whois_contacts(self):
        uri = {
            "domain": self.ANY_DOMAIN,
            "whois": {
                "raw": "Registrar WHOIS Server: whois.markmonitor.com\r\n"
                       "Registrar URL: http://www.markmonitor.com\r\n"
                       "Registrar Registration Expiration Date:\r\n"
                       "Registrar: MarkMonitor Inc.\r\n"
                       "Registrar IANA ID: 292\r\n",
                "servers": [self.ANY_WHOIS_SERVER]
            }
        }

        parse_whois(uri)

        self.assertEqual({}, uri["admin_contacts"])
        self.assertEqual({}, uri["billing_contacts"])
        self.assertEqual({}, uri["registrant_contacts"])
        self.assertEqual({}, uri["technical_contacts"])
Ejemplo n.º 12
0
    def test_parse_whois_status(self):
        uri = {
            "domain": self.ANY_DOMAIN,
            "whois": {
                "raw": "Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited\r\n"
                       "Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited\r\n"
                       "Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited\r\n",
                "servers": [self.ANY_WHOIS_SERVER]
            }
        }

        parse_whois(uri)

        self.assertEqual(
            [
                "clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited",
                "clientTransferProhibited https://icann.org/epp#clientTransferProhibited",
                "clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited"
            ],
            uri["status"]
        )
Ejemplo n.º 13
0
    def test_parse_whois_nameservers(self):
        uri = {
            "domain": self.ANY_DOMAIN,
            "whois": {
                "raw": "Name Server: NS0.WIKIMEDIA.ORG\r\n"
                       "Name Server: NS1.WIKIMEDIA.ORG\r\n"
                       "Name Server: NS2.WIKIMEDIA.ORG\r\n",
                "servers": [self.ANY_WHOIS_SERVER]
            }
        }

        parse_whois(uri)

        self.assertEqual(
            [
                "ns0.wikimedia.org",
                "ns1.wikimedia.org",
                "ns2.wikimedia.org"
            ],
            uri["nameservers"]
        )