From d31db7704bf7c651d398229ae55e5284095166e6 Mon Sep 17 00:00:00 2001 From: Simon de Haan Date: Mon, 13 Jul 2015 23:50:34 +0200 Subject: [PATCH] tests --- consular/tests/test_main.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/consular/tests/test_main.py b/consular/tests/test_main.py index a65805a..5d0fda9 100644 --- a/consular/tests/test_main.py +++ b/consular/tests/test_main.py @@ -228,3 +228,24 @@ def test_sync_app_task(self): self.assertEqual(consul_request['method'], 'PUT') consul_request['deferred'].callback('') yield d + + @inlineCallbacks + def test_sync_app(self): + app = {'id': '/my-app'} + d = self.consular.sync_app(app) + marathon_request = yield self.marathon_requests.get() + self.assertEqual(marathon_request['path'], '/v2/apps/my-app/tasks') + self.assertEqual(marathon_request['method'], 'GET') + marathon_request['deferred'].callback( + FakeResponse(200, [], json.dumps({'tasks': []}))) + yield d + + @inlineCallbacks + def test_sync_apps(self): + d = self.consular.sync_apps() + marathon_request = yield self.marathon_requests.get() + self.assertEqual(marathon_request['path'], '/v2/apps') + self.assertEqual(marathon_request['method'], 'GET') + marathon_request['deferred'].callback( + FakeResponse(200, [], json.dumps({'apps': []}))) + yield d