def testUpdate(self): print(tc.uri(Right).port()) assert tc.uri(Right).port() == 8703 left = start_host("test_multi_host_left", [Left]) right = start_host("test_multi_host_right", [Right]) left.put("/app/balance/weigh", None, 5) print_lines(5) self.assertEqual(left.get("/app/balance/weight"), 5) self.assertEqual(right.get("/app/balance/weight"), 15)
def testStartup(self): expected = 10 host = start_host("test_multi_cluster_startup", [Left, Right]) actual = host.get("/app/balance/left/weight") self.assertEqual(expected, actual) actual = host.get("/app/balance/right/weight") self.assertEqual(expected, actual)
def testUpdate(self): host = start_host("test_update", [ExampleCluster]) def expect(n): actual = host.get("/app/example/rev") self.assertEqual(n, actual) expect(0) host.put("/app/example/rev", None, 2) expect(2) host.put("/app/example/rev", None, 4) expect(4) host.stop() host = start_host("test_update", [ExampleCluster], overwrite=False) actual = host.get("/app/example/rev") self.assertEqual(4, actual)
def testWorkflow(self): host = start_host("test_yc_demo", [Producer, Wholesaler]) actual = host.get("/app/producer/inventory") self.assertEqual(IN_STOCK, actual) with self.assertRaises(tc.error.Unauthorized): host.post("/app/wholesaler/buy", {"quantity": 10}) host.put("/app/producer/install", "http://127.0.0.1:8702" + tc.uri(Wholesaler), ["buy"]) host.post("/app/wholesaler/buy", {"quantity": 10}) self.assertEqual(90, host.get("/app/producer/inventory"))
def setUp(self): self.host = start_host("test_client_docs", [AreaService, ClientService])
def testUpdate(self): host = start_host("test_multi_cluster_update", [Left, Right]) host.put("/app/balance/right/weigh", None, 5) self.assertEqual(host.get("/app/balance/right/weight"), 5) self.assertEqual(host.get("/app/balance/left/weight"), 15)