コード例 #1
0
 def test_print_dict(self):
     cliutils.print_dict({"K": "k", "Key": "Value"})
     cliutils.print_dict({"K": "k", "Key": "Long\\nValue"})
     self.assertEqual(self.mock_add_row.call_args_list,
                      [mock.call(["K", "k"]),
                       mock.call(["Key", "Value"]),
                       mock.call(["K", "k"]),
                       mock.call(["Key", "Long"]),
                       mock.call(["", "Value"])])
コード例 #2
0
 def test_print_dict(self):
     cliutils.print_dict({"K": "k", "Key": "Value"})
     cliutils.print_dict({"K": "k", "Key": "Long\\nValue"})
     self.mock_add_row.assert_has_calls([
         mock.call(["K", "k"]),
         mock.call(["Key", "Value"]),
         mock.call(["K", "k"]),
         mock.call(["Key", "Long"]),
         mock.call(["", "Value"])],
         any_order=True)
コード例 #3
0
 def test_print_dict(self):
     cliutils.print_dict({"K": "k", "Key": "Value"})
     cliutils.print_dict({"K": "k", "Key": "Long\\nValue"})
     self.assertEqual(self.mock_add_row.call_args_list, [
         mock.call(["K", "k"]),
         mock.call(["Key", "Value"]),
         mock.call(["K", "k"]),
         mock.call(["Key", "Long"]),
         mock.call(["", "Value"])
     ])
コード例 #4
0
 def test_print_dict(self):
     cliutils.print_dict({"K": "k", "Key": "Value"})
     cliutils.print_dict({"K": "k", "Key": "Long\\nValue"})
     self.mock_add_row.assert_has_calls([
         mock.call(["K", "k"]),
         mock.call(["Key", "Value"]),
         mock.call(["K", "k"]),
         mock.call(["Key", "Long"]),
         mock.call(["", "Value"])
     ],
                                        any_order=True)
コード例 #5
0
    def test_print_dict_string(self):
        orig = sys.stdout
        sys.stdout = six.StringIO()
        cliutils.print_dict({"K": "k", "Key": "Value"})
        out = sys.stdout.getvalue()
        sys.stdout.close()
        sys.stdout = orig
        expected = '''\
+----------+-------+
| Property | Value |
+----------+-------+
| K        | k     |
| Key      | Value |
+----------+-------+
'''
        self.assertEqual(expected, out)
コード例 #6
0
    def test_print_dict_string(self):
        orig = sys.stdout
        sys.stdout = six.StringIO()
        cliutils.print_dict({"K": "k", "Key": "Value"})
        out = sys.stdout.getvalue()
        sys.stdout.close()
        sys.stdout = orig
        expected = '''\
+----------+-------+
| Property | Value |
+----------+-------+
| K        | k     |
| Key      | Value |
+----------+-------+
'''
        self.assertEqual(expected, out)