tests.test_tasks.TestTasks.test_sample()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 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