Ejemplo n.º 1
0
    def parse_caget_command(self, command):
        """
        Parses the caget command and extracts the important information.

        :param command: the command received over Slack
        :return: a tuple containing whether a string was requested, the PV name and whether un-hexing was required
        """
        as_str = CaGetParser.as_string_requested(command)
        name = CaGetParser.extract_pv_name(command)
        as_uzhex = CaGetParser.uzhex_requested(command)
        return as_str, name, as_uzhex
Ejemplo n.º 2
0
 def test_caget_when_qualifiers_does_not_contain_dash_S_returns_as_string_equals_false(self):
     self.assertEqual(False, CaGetParser.as_string_requested("caget -t IN:DEMO"))
Ejemplo n.º 3
0
 def test_caget_when_qualifiers_contains_dash_S_returns_as_string_equals_true(self):
     self.assertEqual(True, CaGetParser.as_string_requested("caget -S -t IN:DEMO"))
Ejemplo n.º 4
0
 def test_caget_uzhex_requested_returns_false_when_not_present(self):
     self.assertEqual(False, CaGetParser.uzhex_requested("caget -S -t IN:DEMO:X:Y"))
Ejemplo n.º 5
0
 def test_caget_uzhex_requested_returns_true_when_present(self):
     self.assertEqual(True, CaGetParser.uzhex_requested("caget -S -t IN:DEMO:X:Y |uzhex"))
Ejemplo n.º 6
0
 def test_caget_extract_pv_name_with_qualifiers_and_uzhex_returns_name(self):
     self.assertEqual("IN:DEMO:X:Y", CaGetParser.extract_pv_name("caget -S -t IN:DEMO:X:Y |uzhex"))
Ejemplo n.º 7
0
 def test_caget_extract_pv_name_without_qualifiers_returns_name(self):
     self.assertEqual("IN:DEMO:X:Y", CaGetParser.extract_pv_name("caget IN:DEMO:X:Y"))