Ejemplo n.º 1
0
 def retrieveFeatureRequestManager():
     if request.method == 'GET':
         # Instance of FeatureRequestService class is created to accesss functions retrieveFeatureRequestService
         feature = featureRequestService.FeatureRequestService()
         print("inside rretri")
         # Response from retrieveFeatureRequestService is assigned to 'result'
         output = feature.retrieveFeatureRequestService()
         # Returns a JSON response
         return jsonify({'details': output})
 def test_app_featureRequestService_retrieveFeatureRequestService(self):
     """Tests successful retrieval of values from database for Feature Request Details"""
     mock = MagicMock(Config.Session())
     print("inside Mock test Feature request service", mock)
     # Creating an instance of FeatureRequestService class
     servicerequest = featureRequestService.FeatureRequestService()
     # setting a mock session using setSession function in FeatureRequestService class
     servicerequest.setSession(mock)
     print("mock set", servicerequest.getSession())
     # Creating an instance of FeatureRequestApp model class with all required values
     result = servicerequest.retrieveFeatureRequestService()
     # Checking result of retrieveFeatureRequestService
     self.assertIsNotNone(result)
Ejemplo n.º 3
0
 def test_app_featureRequestService_createFeatureRequestService(self):
     """Tests successful submission of values in Feature Requests Form Page"""
     # Create an instance of MagicMock class with specification Session Class which gives a 'mock'Session instance
     mock = MagicMock(Config.Session())
     print("inside Mock test Feature request service", mock)
     # Creating an instance of FeatureRequestService class
     frs = featureRequestService.FeatureRequestService()
     # setting a mock session using setSession function in FeatureRequestService class
     frs.setSession(mock)
     print("mock set", frs.getSession())
     # Creating an instance of FeatureRequestApp model class with all required values
     fra = FeatureRequestApp('Titl5', 'descr', 'Client B', 1, 'Billing',
                             '2018-02-01')
     result = frs.createFeatureRequestService(fra)
     self.assertEqual(result, 'success')
Ejemplo n.º 4
0
 def createFeatureRequestManager():
     # Instance of FeatureRequestService class is created to accesss functions createFeatureRequestService
     featurerequestservice = featureRequestService.FeatureRequestService(
     )
     print("Inside Create")
     if request.method == 'POST':
         # Createing a FeatureRequestApp class object with title, description, client, clientPriority, targetData and productArea as arguments
         featureRequestApp = FeatureRequestApp(
             request.json['title'], request.json['description'],
             request.json['client'], request.json['clientPriority'],
             request.json['targetDate'], request.json['productArea'])
         # Response from createFeatureRequestService is assigned to 'result'
         result = featurerequestservice.createFeatureRequestService(
             featureRequestApp)
         # Returns a String response
         return result
 def test_app_featureRequestService_createFeatureRequestService_failure(
         self):
     """Tests successful submission of values in Feature Requests Form Page"""
     # Create an instance of MagicMock class with specification Session Class which gives a 'mock'Session instance
     mock = MagicMock(Config.Session())
     print("inside Mock test Feature request service", mock)
     # Creating an instance of FeatureRequestService class
     servicerequest = featureRequestService.FeatureRequestService()
     # setting a mock session using setSession function in FeatureRequestService class
     servicerequest.setSession(mock)
     print("mock set", servicerequest.getSession())
     # Creating an instance of FeatureRequestApp model class with invalidvalues
     insertrequestdata = FeatureRequestApp('TestTitle1', 'TestDesc1',
                                           'Client A', 'invalidvalue',
                                           'Policies', '2018-03-02')
     result = servicerequest.createFeatureRequestService(insertrequestdata)
     self.assertEqual(result, 'Error Occured')
Ejemplo n.º 6
0
 def editFeatureRequestManager():
     print("Inside editFeatureRequestManager")
     # Instance of FeatureRequestService class is created to accesss function editFeatureRequestService
     featurerequestserviceInstance = featureRequestService.FeatureRequestService(
     )
     # Checks request mehtod is POST
     if request.method == 'POST':
         # Assigning FeatureRequestApp class object with title, description, client, clientPriority, targetData and productArea json values as arguments to editFeatureRequestService function
         # Response from createFeatureRequestService is assigned to 'result'
         result = featurerequestserviceInstance.editFeatureRequestService(
             FeatureRequestApp(request.json['title'],
                               request.json['description'],
                               request.json['client'],
                               request.json['clientPriority'],
                               request.json['targetDate'],
                               request.json['productArea']))
         # Returns a String response
         return result