示例#1
0
    def test_get_response_for_feature_request(self):
        expected_data = {
            "feature_requests": [{
                "client_name": "Client_A",
                "client_priority": 1,
                "description": "this is test",
                "product_area": "Billing",
                "target_date": "Tue, 30 Aug 2016 15:49:56 GMT",
                "title": "test"
            }]
        }
        product = Product('Billing')
        product.create(product)

        client = Client('Client_A')
        client.create(client)

        request = Request(title='test',
                          description='this is test',
                          client=client.id,
                          client_priority=1,
                          target_date='2016-12-22',
                          product_area=product.id)

        request.create(request)
        response = self.app.get('/api/feature-request/')

        self.assertEqual(response.status_code, 200)
        response_data = json.loads(response.data)
        self.assertEqual(len(response_data['feature_requests']), 1)
        self.assertEqual(response_data['feature_requests'][0]['client_name'],
                         expected_data['feature_requests'][0]['client_name'])
    def test_product_model(self):
        client = Client('Client_A')
        client.create(client)

        self.assertTrue(client.id)
        self.assertTrue(client.created_at)
        self.assertTrue(client == Client.find_by(name='Client_A'))
示例#3
0
    def test_post_for_feature_request(self):
        FeatureRequestUtils.create_request()
        client = Client.find_by(name='ClientA')
        product = Product.find_by(name='Billing')

        feature_request = {
            'title': 'Automate the deployment to AWS Server',
            'description':
            'As a client I can deploy the latest change to AWS Server for demo',
            "client_id": client.id,
            "client_priority": 1,
            "product_id": product.id,
            "target_date": '2017-09-20'
        }

        expected = {'status': 'success', 'reason': 'Feature request added'}

        response = self.app.post('/api/feature-request/',
                                 data=json.dumps(feature_request),
                                 content_type='application/json')

        response_data = json.loads(response.data)
        del response_data['feature_request']

        self.assertEqual(response_data, expected)
        self.assertEqual(response.status_code, 201)
示例#4
0
    def test_put_request_for_id_present(self):
        FeatureRequestUtils.create_request()

        update_feature_request = {
            'title': 'Automate the deployment to Azure Server',
            'description':
            'As a client I can deploy the latest change to Azure Server for demo',
            "client_priority": 2,
            "target_date": '2017-09-20'
        }

        client = Client.find_by(name='ClientA')
        feature_request = Request.find_by(client=client.id)

        expected = {'status': 'success', 'reason': 'Feature request updated'}

        response = self.app.put('/api/feature-request/' + feature_request.id,
                                data=json.dumps(update_feature_request),
                                content_type='application/json')

        feature_request = Request.find_by(id=feature_request.id)
        response_data = json.loads(response.data)

        self.assertEqual(response_data['reason'], expected['reason'])
        self.assertEqual(feature_request.title,
                         update_feature_request['title'])
        self.assertEqual(feature_request.description,
                         update_feature_request['description'])
        self.assertEqual(response.status_code, 200)
    def test_request_model(self):
        product = Product('Billing')
        product.create(product)

        client = Client('Client_A')
        client.create(client)

        request = Request(title='test',
                          description='this is test',
                          client=client.id,
                          client_priority=1,
                          target_date='2017-03-12',
                          product_area=product.id)
        request.create(request)

        find_all_request = Request.query.filter().all()
        self.assertTrue('test' == find_all_request[0].title)
        self.assertTrue('this is test' == find_all_request[0].description)
        self.assertTrue(client.id == find_all_request[0].client)
        self.assertTrue(product.id == find_all_request[0].product_area)
示例#6
0
    def test_post_getting_saved(self):
        FeatureRequestUtils.create_request()
        client = Client.find_by(name='ClientA')
        product = Product.find_by(name='Billing')

        feature_request = {
            'title': 'Automate the deployment to AWS Server',
            'description':
            'As a client I can deploy the latest change to AWS Server for demo',
            "client_id": client.id,
            "client_priority": 1,
            "product_id": product.id,
            "target_date": '2017-09-20'
        }

        response = self.app.post('/api/feature-request/',
                                 data=json.dumps(feature_request),
                                 content_type='application/json')

        response = self.app.get('/api/feature-request/')
        response_data = json.loads(response.data)

        self.assertEqual(response.status_code, 200)
        self.assertEqual(len(response_data["feature_requests"]), 4)
示例#7
0
    def __init__(self):
        client_1 = Client('Client_A')
        client_1.insert(client_1)

        client_2 = Client('Client_B')
        client_2.insert(client_2)

        client_3 = Client('Client_C')
        client_3.insert(client_3)

        Client.save()

        product_1 = Product('Policies')
        product_1.insert(product_1)

        product_2 = Product('Billing')
        product_2.insert(product_2)

        product_3 = Product('Claims')
        product_3.insert(product_3)

        product_4 = Product('Reports')
        product_4.insert(product_4)

        Product.save()

        request_1 = Request(
            title='Public User Profile',
            description=
            'A public user profile that can be visited by clicking on any users name from the organisation view',
            client=client_1.id,
            client_priority=1,
            product_area=product_2.id,
            target_date='2017-1-20')

        request_1.insert(request_1)

        request_2 = Request(
            title='Email system for sending emails and email verification',
            description=
            'User email validation is where we verify a users email when they sign up with a token/code sent to their inbox',
            client=client_2.id,
            client_priority=2,
            product_area=product_3.id,
            target_date='2016-12-2')

        request_2.insert(request_2)

        request_3 = Request(
            title='Add customer satisfaction survey',
            description=
            'Client wants to be able to send out a survey to evaluate customer satisfaction after issuing a new claim',
            client=client_3.id,
            client_priority=1,
            product_area=product_1.id,
            target_date='2016-11-11')

        request_3.insert(request_3)

        request_3.save()

        print "Successfully add data to db"
示例#8
0
    def create_request():
        client_1 = Client('ClientA')
        client_1.insert(client_1)

        client_2 = Client('ClientB')
        client_2.insert(client_2)

        client_3 = Client('ClientC')
        client_3.insert(client_3)

        Client.save()

        product_1 = Product('Policies')
        product_1.insert(product_1)

        product_2 = Product('Billing')
        product_2.insert(product_2)

        Product.save()

        request = Request(title='Add Login Page',
                          description='Client want to have oauth base login',
                          client=client_1.id,
                          client_priority=1,
                          target_date='2016-12-01',
                          product_area=product_1.id)
        request.insert(request)

        request = Request(
            title='Add Bootstrap in User Module',
            description=
            'Client want to have bootstrap framework in user module',
            client=client_2.id,
            client_priority=2,
            target_date='2016-11-12',
            product_area=product_2.id)
        request.insert(request)

        request = Request(
            title='Implement Send Mail Feature',
            description=
            'Client want to mail where he/she can send direct mail to them from own domain',
            client=client_1.id,
            client_priority=2,
            target_date='2017-01-01',
            product_area=product_1.id)
        request.insert(request)

        request.save()