Exemple #1
0
    def test_templates_missing_plan(self, mock_package):
        # Setup
        mock_package.side_effect = storage_exceptions.UnknownUUID()

        # Test
        url = URL_PLANS + '/' + 'foo' + '/' + 'templates'
        response = self.app.get(url, status=404)

        # Verify
        self.assertEqual(response.status_int, 404)
Exemple #2
0
    def test_get_one_invalid_uuid(self, mock_retrieve):
        # Setup
        mock_retrieve.side_effect = storage_exceptions.UnknownUUID()

        # Test
        url = URL_PLANS + '/' + 'qwerty12345'
        response = self.app.get(url, status=404)

        # Verify
        mock_retrieve.assert_called_once_with('qwerty12345')
        self.assertEqual(response.status_int, 404)
Exemple #3
0
    def test_delete_unkown_uuid(self, mock_remove):
        # Setup
        mock_remove.side_effect = storage_exceptions.UnknownUUID()

        # Test
        response = self.app.delete_json(URL_PLAN_ROLES + '/qwerty12345',
                                        status=404)

        # Verify
        mock_remove.assert_called_once_with('plan_uuid', 'qwerty12345')
        self.assertEqual(response.status_int, 404)
Exemple #4
0
    def test_post_unkown_uuid(self, mock_add):
        # Setup
        mock_add.side_effect = storage_exceptions.UnknownUUID()

        # Test
        role_data = {'uuid': 'qwerty12345'}
        response = self.app.post_json(URL_PLAN_ROLES,
                                      params=role_data,
                                      status=404)

        # Verify
        mock_add.assert_called_once_with('plan_uuid', 'qwerty12345')
        self.assertEqual(response.status_int, 404)
Exemple #5
0
    def test_patch_missing_plan(self, mock_set):
        # Setup
        mock_set.side_effect = storage_exceptions.UnknownUUID()

        # Test
        values = [{'name': 'foo', 'value': 'bar'}]
        url = URL_PLANS + '/' + 'qwerty12345'
        response = self.app.patch_json(url, values, status=404)

        # Verify
        self.assertEqual(mock_set.call_args[0][0], 'qwerty12345')
        self.assertEqual(mock_set.call_args[0][1][0].name, 'foo')
        self.assertEqual(mock_set.call_args[0][1][0].value, 'bar')
        self.assertEqual(response.status_int, 404)