-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_apps.py
More file actions
46 lines (37 loc) · 1.38 KB
/
test_apps.py
File metadata and controls
46 lines (37 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
Unit tests for the Deis CLI apps commands.
Run these tests with "python -m unittest client.tests.test_apps"
or with "./manage.py test client.AppsTest".
"""
from __future__ import unicode_literals
from unittest import TestCase
from uuid import uuid4
import pexpect
from .utils import DEIS
from .utils import DEIS_TEST_FLAVOR
from .utils import random_repo
from .utils import setup
from .utils import teardown
class AppsTest(TestCase):
@classmethod
def setUpClass(cls):
repo_name, repo_url = random_repo()
cls.username, cls.password, cls.repo_dir = setup(repo_url)
# create a new formation
cls.formation = "{}-test-formation-{}".format(
cls.username, uuid4().hex[:4])
child = pexpect.spawn("{} formations:create {} --flavor={}".format(
DEIS, cls.formation, DEIS_TEST_FLAVOR))
child.expect("created {}.*to scale a basic formation".format(
cls.formation))
child.expect(pexpect.EOF)
@classmethod
def tearDownClass(cls):
# delete the formation
child = pexpect.spawn("{} formations:destroy {} --confirm={}".format(
DEIS, cls.formation, cls.formation))
child.expect('done in ', timeout=5*60)
child.expect(pexpect.EOF)
teardown(cls.username, cls.password, cls.repo_dir)
def test_app_create(self):
self.assertIsNotNone(self.formation)