def test_GetData_ReturnValidFormat_True(self): obj = FbExporter(accessToken=TEST_TOKEN) resp = obj.getData() self.assertIn('retCode', resp) self.assertEqual(resp['retCode'], ErrorCode.S_OK) self.assertTrue(ErrorCode.IS_SUCCEEDED(resp['retCode'])) self.assertIn('data', resp) self.assertTrue(type(resp['data']), list) self.assertIn('count', resp) self.assertTrue(type(resp['count']), int)
def test_IsTokenValid_GivenInValidToken_E_INVALID_TOKEN(self): obj = FbExporter(accessToken='invalid_token') resp = obj.isTokenValid() self.assertEqual(resp, ErrorCode.E_INVALID_TOKEN)
def test_IsTokenValid_GivenValidToken_S_OK(self): obj = FbExporter(accessToken=TEST_TOKEN) resp = obj.isTokenValid() self.assertEqual(resp, ErrorCode.S_OK)
def test_GetData_GivenInvalidToken_ReturnInvalidToken(self): obj = FbExporter(accessToken='invalid_token') resp = obj.getData() self.assertIn('retCode', resp) self.assertEqual(resp['retCode'], ErrorCode.E_INVALID_TOKEN)