Exemplo n.º 1
0
 def test_add_command_existing_values_and_one_new(self):
     """
     A smoke test to ensure nothing bizarre happens when we try to add existing addons attribute
     and also try to add one new value
     """
     args = MagicMock()
     args.prop_name = "addons"
     args.values = ["ADDON1", "ADDON2"]
     with Capture() as captured:
         cli.add_command(args, self.syspurposestore)
         self.assertTrue('Added ADDON1 to addons' in captured.out)
         self.assertTrue('Added ADDON2 to addons' in captured.out)
         self.assertTrue('addons updated.' in captured.out)
     # Try to add same addons once again
     args.prop_name = "addons"
     args.values = ["ADDON1", "ADDON2", "ADDON3"]
     with Capture() as captured:
         cli.add_command(args, self.syspurposestore)
         self.assertTrue(
             'Not adding value ADDON1 to addons; it already exists.' in
             captured.out)
         self.assertTrue(
             'Not adding value ADDON2 to addons; it already exists.' in
             captured.out)
         self.assertTrue('Added ADDON3 to addons' in captured.out)
         self.assertTrue('addons updated.' in captured.out)
Exemplo n.º 2
0
 def test_add_generic_command_one_value(self):
     """
     A smoke test to ensure nothing bizarre happens when we try to add some attribute (not addons)
     """
     args = MagicMock()
     args.prop_name = "foo"
     args.values = ["BAR1"]
     with Capture() as captured:
         cli.add_command(args, self.syspurposestore)
         self.assertTrue('Added BAR1 to foo' in captured.out)
Exemplo n.º 3
0
 def test_add_command_more_values(self):
     """
     A smoke test to ensure nothing bizarre happens when we try to add value to addons attribute
     """
     args = MagicMock()
     args.prop_name = "addons"
     args.values = ["ADDON1", "ADDON2"]
     with Capture() as captured:
         cli.add_command(args, self.syspurposestore)
         self.assertTrue('Added ADDON1 to addons' in captured.out)
         self.assertTrue('Added ADDON2 to addons' in captured.out)
Exemplo n.º 4
0
 def test_add_generic_command_more_value(self):
     """
     A smoke test to ensure nothing bizarre happens when we try to add more generic list attribute
     """
     args = MagicMock()
     args.prop_name = "foo"
     args.values = ["BAR1", "BAR2"]
     with Capture() as captured:
         cli.add_command(args, self.syspurposestore)
         self.assertTrue('Added BAR1 to foo' in captured.out)
         self.assertTrue('Added BAR2 to foo' in captured.out)
         self.assertTrue('foo updated.' in captured.out)
Exemplo n.º 5
0
    def test_generic_remove_command(self):
        """
        A smoke test to ensure nothing bizarre happens when we try to remove one value from generic list
        """
        args = MagicMock()

        # Add value first
        args.prop_name = "foo"
        args.values = ["BAR1"]
        cli.add_command(args, self.syspurposestore)

        # Now we can try to remove value
        with Capture() as captured:
            cli.remove_command(args, self.syspurposestore)
            self.assertTrue('Removed "BAR1" from foo' in captured.out)
Exemplo n.º 6
0
    def test_remove_command(self):
        """
        A smoke test to ensure nothing bizarre happens when we try to remove one value from addons attribute
        """
        args = MagicMock()

        # Add value first
        args.prop_name = "addons"
        args.values = ["ADDON1"]
        cli.add_command(args, self.syspurposestore)

        # Now we can try to remove value
        with Capture() as captured:
            cli.remove_command(args, self.syspurposestore)
            self.assertTrue('Removed "ADDON1" from addons' in captured.out)