forked from openshift/python-interface
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapps.py
More file actions
executable file
·60 lines (51 loc) · 1.91 KB
/
apps.py
File metadata and controls
executable file
·60 lines (51 loc) · 1.91 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python
import os
import sys
import unittest
dirname = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(dirname, ".."))
from oshift import *
class TestUser(unittest.TestCase):
"""
Test REST API related to app only test one framework for quick testing
"""
li = None
domain_name = "autotest"
app_name = "myapp"
def setUp(self):
self.assertTrue(os.environ.has_key('OPENSHIFT_USER'),
'Missing Openshift username!')
self.assertTrue(os.environ.has_key('OPENSHIFT_PASSWD'),
'Missing Openshift password!')
self.assertTrue(os.environ.has_key("OPENSHIFT_IP"),
'Missing instance ip variable!')
li = Openshift(host=os.getenv('OPENSHIFT_IP'), user=os.getenv('OPENSHIFT_USER'),
passwd=os.getenv('OPENSHIFT_PASSWD'))
self.li = li
status, res = li.domain_create(self.domain_name)
if status != 201:
msg = res['messages'][0]['text']
raise OpenShiftNullDomainException("Unable to create domain: %s" % msg)
def test_app_create_delete(self):
status, res = self.li.app_create(app_name=self.app_name, app_type="php-5.3")
self.assertTrue(status, 'Created')
status, res = self.li.app_delete(self.app_name)
self.assertTrue(status, 'No Content')
print status
def tearDown(self):
print "####################"
status, res = self.li.domain_delete(self.domain_name)
"""
@classmethod
def tearDownClass(cls):
print '######## Cleaning up... #################'
cls.li.domain_delete(cls.domain_name)
"""
if __name__ == '__main__':
"""
li = Openshift(host=os.getenv('OPENSHIFT_IP'), user=os.getenv('OPENSHIFT_USER'),
passwd=os.getenv('OPENSHIFT_PASSWD'))
status, res = li.app_create(app_name='myapp', app_type='php-5.3')
print status
"""
unittest.main()