<commit_before>#!/ms/dist/python/PROJ/core/2.5.0/bin/python
# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# Copyright (C) 2008 <NAME>
#
# This module is part of Aquilon
"""Module for testing the map service command."""

import os
import sys
import unittest

if __name__ == "__main__":
    BINDIR = os.path.dirname(os.path.realpath(sys.argv[0]))
    SRCDIR = os.path.join(BINDIR, "..", "..")
    sys.path.append(os.path.join(SRCDIR, "lib", "python2.5"))

from brokertest import TestBrokerCommand


class TestMapService(TestBrokerCommand):

    def testmapafs(self):
        self.noouttest(["map", "service", "--building", "ut",
            "--service", "afs", "--instance", "q.ny.ms.com"])

    def testverifymapafs(self):
        command = "show map --service afs --instance q.ny.ms.com --building ut"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out,
                "Service: afs Instance: q.ny.ms.com Map: Building ut", command)

    def testmapdns(self):
        self.noouttest(["map", "service", "--hub", "ny",
            "--service", "dns", "--instance", "nyinfratest"])

    def testverifymapdns(self):
        command = "show map --service dns --instance nyinfratest --hub ny"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out,
                "Service: dns Instance: nyinfratest Map: Hub ny", command)

    def testmapaqd(self):
        self.noouttest(["map", "service", "--hub", "ny",
            "--service", "aqd", "--instance", "ny-prod"])

    def testverifymapdns(self):
        command = "show map --service aqd --instance ny-prod --hub ny"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out,
                "Service: aqd Instance: ny-prod Map: Hub ny", command)

    def testmapbootserver(self):
        self.noouttest(["map", "service", "--rack", "ut3",
            "--service", "bootserver", "--instance", "np.test"])

    def testverifymapbootserver(self):
        command = "show map --service bootserver --instance np.test --rack ut3"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out,
                "Service: bootserver Instance: np.test Map: Rack ut3", command)

    def testmapntp(self):
        self.noouttest(["map", "service", "--city", "ny",
            "--service", "ntp", "--instance", "pa.ny.na"])

    def testverifymapntp(self):
        command = "show map --service ntp --instance pa.ny.na --city ny"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out,
                "Service: ntp Instance: pa.ny.na Map: City ny", command)

    def testmaputsi1(self):
        self.noouttest(["map", "service", "--building", "ut",
            "--service", "utsvc", "--instance", "utsi1"])

    def testmaputsi2(self):
        self.noouttest(["map", "service", "--building", "ut",
            "--service", "utsvc", "--instance", "utsi2"])

    def testverifymaputsvc(self):
        command = "show map --service utsvc"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out,
                "Service: utsvc Instance: utsi1 Map: Building ut", command)
        self.matchoutput(out,
                "Service: utsvc Instance: utsi2 Map: Building ut", command)

    def testverifynyhubmapproto(self):
        command = "show map --hub ny"
        out = self.commandtest(command.split(" "))<commit_msg>service map test fixed (missing --proto...)<commit_after>#!/ms/dist/python/PROJ/core/2.5.0/bin/python
# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# Copyright (C) 2008 <NAME>
#
# This module is part of Aquilon
"""Module for testing the map service command."""

import os
import sys
import unittest

if __name__ == "__main__":
    BINDIR = os.path.dirname(os.path.realpath(sys.argv[0]))
    SRCDIR = os.path.join(BINDIR, "..", "..")
    sys.path.append(os.path.join(SRCDIR, "lib", "python2.5"))

from brokertest import TestBrokerCommand


class TestMapService(TestBrokerCommand):

    def testmapafs(self):
        self.noouttest(["map", "service", "--building", "ut",
            "--service", "afs", "--instance", "q.ny.ms.com"])

    def testverifymapafs(self):
        command = "show map --service afs --instance q.ny.ms.com --building ut"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out,
                "Service: afs Instance: q.ny.ms.com Map: Building ut", command)

    def testmapdns(self):
        self.noouttest(["map", "service", "--hub", "ny",
            "--service", "dns", "--instance", "nyinfratest"])

    def testverifymapdns(self):
        command = "show map --service dns --instance nyinfratest --hub ny"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out,
                "Service: dns Instance: nyinfratest Map: Hub ny", command)

    def testmapaqd(self):
        self.noouttest(["map", "service", "--hub", "ny",
            "--service", "aqd", "--instance", "ny-prod"])

    def testverifymapdns(self):
        command = "show map --service aqd --instance ny-prod --hub ny"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out,
                "Service: aqd Instance: ny-prod Map: Hub ny", command)

    def testmapbootserver(self):
        self.noouttest(["map", "service", "--rack", "ut3",
            "--service", "bootserver", "--instance", "np.test"])

    def testverifymapbootserver(self):
        command = "show map --service bootserver --instance np.test --rack ut3"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out,
                "Service: bootserver Instance: np.test Map: Rack ut3", command)

    def testmapntp(self):
        self.noouttest(["map", "service", "--city", "ny",
            "--service", "ntp", "--instance", "pa.ny.na"])

    def testverifymapntp(self):
        command = "show map --service ntp --instance pa.ny.na --city ny"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out,
                "Service: ntp Instance: pa.ny.na Map: City ny", command)

    def testmaputsi1(self):
        self.noouttest(["map", "service", "--building", "ut",
            "--service", "utsvc", "--instance", "utsi1"])

    def testmaputsi2(self):
        self.noouttest(["map", "service", "--building", "ut",
            "--service", "utsvc", "--instance", "utsi2"])

    def testverifymaputsvc(self):
        command = "show map --service utsvc"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out,
                "Service: utsvc Instance: utsi1 Map: Building ut", command)
        self.matchoutput(out,
                "Service: utsvc Instance: utsi2 Map: Building ut", command)

    def testverifyutmapproto(self):
        command = "show map --building ut --format proto"
        out = self.commandtest(command.split(" "))
{'fraction_non_alphanumeric': 0.1700993806711796, 'fraction_numerical': 0.006337318162177733, 'mean_word_length': 2.577537351880474, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1189518', 'n_tokens_mistral': 2261, 'n_tokens_neox': 2222, 'n_words': 537}