Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

started to test the web UI

  • Loading branch information...
commit 12abc975cb2bd0f0c88f177f5f500cf3afd9bd48 1 parent caf9c3d
Tarek Ziade tarekziade authored
Showing with 54 additions and 0 deletions.
  1. +1 −0  Makefile
  2. +10 −0 circus/tests/test_web.ini
  3. +43 −0 circus/tests/test_web.py
1  Makefile
View
@@ -23,6 +23,7 @@ bin/sphinx-build: bin/python
bin/nosetests: bin/python
bin/pip install nose
+ bin/pip install WebTest
bin/coverage: bin/python
bin/pip install coverage
10 circus/tests/test_web.ini
View
@@ -0,0 +1,10 @@
+[circus]
+check_delay = 5
+endpoint = tcp://127.0.0.1:5555
+pubsub_endpoint = tcp://127.0.0.1:5556
+stats_endpoint = tcp://127.0.0.1:5557
+
+[watcher:sleeper]
+cmd = sleep 120
+warmup_delay = 0
+numprocesses = 1
43 circus/tests/test_web.py
View
@@ -0,0 +1,43 @@
+import subprocess
+import os
+import sys
+import time
+
+from webtest import TestApp
+
+from circus.tests.support import TestCircus
+from circus.web.circushttpd import app
+from circus.stream import QueueStream
+
+
+cfg = os.path.join(os.path.dirname(__file__), 'test_web.ini')
+
+
+class TestHttpd(TestCircus):
+ def setUp(self):
+ TestCircus.setUp(self)
+ self.app = TestApp(app)
+ self.stream = QueueStream()
+ # let's run a circus
+ cmd = '%s -c "from circus import circusd; circusd.main()" %s' % \
+ (sys.executable, cfg)
+ self.p = subprocess.Popen(cmd, shell=True)
+
+ def tearDown(self):
+ self.p.terminate()
+ self.p.wait()
+ time.sleep(0.4)
+ TestCircus.tearDown(self)
+
+ def test_index(self):
+ # let's open the web app
+ res = self.app.get('/')
+
+ # we have a form to connect to the current app
+ res = res.form.submit()
+
+ # that should be a 302, redirecting to the connected index
+ # let's follow it
+ res = res.follow()
+
+ self.assertTrue('tcp://127.0.0.1:5557' in res.body)
Please sign in to comment.
Something went wrong with that request. Please try again.