| Total Complexity | 3 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import unittest |
||
| 2 | from werkzeug.exceptions import BadRequest |
||
| 3 | from .test_client import TestClient |
||
| 4 | from api.app import create_app |
||
| 5 | from api.models import db |
||
| 6 | from api.errors import ValidationError |
||
| 7 | from api.helpers import convert_url |
||
| 8 | from api.tasks import sample |
||
| 9 | import time |
||
| 10 | |||
| 11 | |||
| 12 | class TestTasks(unittest.TestCase): |
||
| 13 | default_username = 'mamad' |
||
| 14 | default_password = 'jafar' |
||
| 15 | |||
| 16 | def setUp(self): |
||
| 17 | self.app = create_app('test_config') |
||
| 18 | self.ctx = self.app.app_context() |
||
| 19 | self.ctx.push() |
||
| 20 | db.drop_all() |
||
| 21 | db.create_all() |
||
| 22 | self.client = TestClient(self.app, None, None) |
||
| 23 | self.task = sample.apply() |
||
| 24 | self.results = self.task.get() |
||
| 25 | |||
| 26 | def tearDown(self): |
||
| 27 | db.session.remove() |
||
| 28 | db.drop_all() |
||
| 29 | self.ctx.pop() |
||
| 30 | |||
| 31 | def test_sample(self): |
||
| 32 | self.assertEqual(self.task.state, "SUCCESS") |
||
| 33 |