Пример #1
0
    def test_get_user_skill_ok_response(self, mock_user_skill_repo_get):
        """Test get_user_skill OK response."""
        # Arrange
        with self.app.app_context():
            mock_user_skill_repo_get.return_value = self.mock_user_skill
            user_skill_controller = UserSkillController(self.request_context)

            # Act
            result = user_skill_controller.get_user_skill(1)

            # Assert
            assert result.status_code == 200
            assert result.get_json()["msg"] == "OK"
Пример #2
0
    def test_get_user_skill_when_invalid_or_missing(self,
                                                    mock_user_skill_repo_get):
        """Test get_user_skill invalid repo response."""
        # Arrange
        with self.app.app_context():
            mock_user_skill_repo_get.return_value = None
            user_skill_controller = UserSkillController(self.request_context)

            # Act
            result = user_skill_controller.get_user_skill(99)

            # Assert
            assert result.status_code == 400
            assert (result.get_json()["msg"] ==
                    "Invalid User Project or Missing user_skill_id")