Ejemplo n.º 1
0
def test_api():
    response = app.test_client().get(
        '/weo',
        data=json.dumps({
            'Total investment': 123333,
            'General government revenue': 345,
            'General government total expenditure': 2342.43,
            'General government primary net lending/borrowing': 3.43,
            'General government gross debt': 2342.34
        }),
        content_type='application/json',
    )

    data = json.loads(response.get_data(as_text=True))

    assert response.status_code == 200
Ejemplo n.º 2
0
 def setUp(self):
     # creates a test client
     self.app = app.test_client()
     # propagate the exceptions to the test client
     self.app.testing = True
Ejemplo n.º 3
0
 def test_statusCode(self):
     tester = app.test_client(self)
     response = tester.get('/')
     self.assertEqual(response.status_code, 200)
Ejemplo n.º 4
0
 def test_contentLength(self):
     # The length of the content should be 2
     tester = app.test_client(self)
     response = tester.get("/")
     jsonData = json.loads(response.data)["movies"]
     self.assertEqual(len(jsonData), 2)
 def test_response1(self):
     tester = app.test_client(self)
     response = tester.get('/')
     statuscode = response.status_code
     self.assertEqual(statuscode, 200)
    def test_content_length(self):
        tester = app.test_client(self)
        response = tester.get('/io')
        temp = json.loads(response.data)['tasks']

        self.assertGreater(len(temp), 0, msg='Not Populated')
 def test_content_data(self):
     tester = app.test_client(self)
     response = tester.get('/io')
     self.assertTrue(b'id' in response.data)
 def test_content_type(self):
     tester = app.test_client(self)
     response = tester.get('/io')
     print(response.content_type)
     self.assertEqual(response.content_type, 'application/json')
Ejemplo n.º 9
0
 def setUp(self):
     # creates a test client
     self.app = app.test_client()
     # propagate the exceptions to the test client
     self.app.testing = True