def test_RemoveAppWithoutLogin(self, delete): am = AppManager("target", self.dbn) capture = py.io.StdCaptureFD(in_=False) am.remove("myapp") out, err = capture.reset() delete.not_called() self.assertEquals(out.strip(), ELoginFirst)
def test_GetAppWithoutLogin(self, get): am = AppManager("target", self.dbn) capture = py.io.StdCaptureFD(in_=False) am.get("myapp") out, err = capture.reset() get.not_called() self.assertEquals(out.strip(), ELoginFirst)
def test_AddUnitWithoutLogin(self, put): am = AppManager("target", self.dbn) capture = py.io.StdCaptureFD(in_=False) am.unitadd("myapp", 5) out, err = capture.reset() put.not_called() self.assertEquals(out.strip(), ELoginFirst)
def test_RemoveAppWithLogin(self, delete): self.loggedin() am = AppManager("target", self.dbn) capture = py.io.StdCaptureFD(in_=False) am.remove("myapp") out, err = capture.reset() delete.assert_called_with("target/apps/myapp", headers=TestAuthHeader) self.assertEquals(out.strip(), IRemoveApp)
def test_ListAppsWithLogin(self, get): t = self.cfgdb.get_default_target() eq_(t['name'], 'local') eq_(t['url'], 'http://127.0.0.1:8080') self.loggedin() am = AppManager("target", self.dbn) am.list() get.assert_called_with("target/apps", headers=TestAuthHeader)
def test_AddUnitWithLogin(self, put): self.loggedin() am = AppManager("target", self.dbn) capture = py.io.StdCaptureFD(in_=False) am.unitadd("myapp", 5) out, err = capture.reset() put.assert_called_with("target/apps/myapp/units", data=str(5), headers=TestAuthHeader) self.assertEquals(out.strip(), IAddUnit)
def test_CreateAppWithoutLogin(self, post): am = AppManager("target", self.dbn) data = { "name": "myapp", "framework": "python2.7", "units": 5 } b = json.dumps(data) capture = py.io.StdCaptureFD(in_=False) am.create("myapp", "python2.7", 5) out, err = capture.reset() post.not_called() self.assertEquals(out.strip(), ELoginFirst)
def test_CreateAppWithLogin(self, post): self.loggedin() am = AppManager("target", self.dbn) data = { "name": "myapp", "framework": "python2.7", "units": 5 } b = json.dumps(data) capture = py.io.StdCaptureFD(in_=False) am.create("myapp", "python2.7", 5) out, err = capture.reset() post.assert_called_with("target/apps", data=b, headers=TestAuthHeader) self.assertEquals(out.strip(), ICreateApp)
def test_GetAppWithLogin(self, get): self.loggedin() am = AppManager("target", self.dbn) am.get("myapp") get.assert_called_with("target/apps/myapp", headers=TestAuthHeader)