Esempio n. 1
0
class ActionControllerTestCase(ValidatorTestCase):
    """Tests for class ValidateController """

    def setUp(self):
        """Create a ValidateController instance """
        super(ActionControllerTestCase, self).setUp()
        CONF.set_override('url', "url", group='clients_docker')
        self.action = ValidateController()

    def test_validate(self):
        """Tests for method validate """
        self.action.ve.validate_cookbook = mock.MagicMock(return_value="OK")
        req = "MyInput"
        body = {"cookbook": "fakecb", "image": "fakeimg"}
        expected = "OK"
        observed = self.action.validate(req, body)
        self.assertEqual(expected, observed)


    def tearDown(self):
        """Cleanup the ValidateController instance """
        super(ActionControllerTestCase, self).tearDown()
        self.m.UnsetStubs()
        self.m.ResetAll()
Esempio n. 2
0
 def setUp(self):
     """Create a ValidateController instance """
     super(ActionControllerTestCase, self).setUp()
     CONF.set_override('url', "url", group='clients_docker')
     self.action = ValidateController()