def test_turn_on_protection_and_try_disable_with_wrong_password(self): self.assertTrue( machines.protect(self.example_machine["id"], password=load_spring_configuration().get( "rules").get("password")), "Response from the service should be True") r = reservations.get_specific_reservation(self.example_machine["id"]) self.assertTrue(r["protected"], "Machine should be protected") self.assertFalse( machines.protect(self.example_machine["id"], password="******"), "Response from the service should be False") self.assertTrue(r["protected"], "Machine should be protected")
def test_negative_try_reserve_protected_machine_wo_password(self): self.assertFalse( machines.protect(self.example_machine["id"], password="******"), "Response from the service should be False") r = reservations.get_specific_reservation(self.example_machine["id"]) self.assertFalse(r["protected"], "Machine should be unprotected")
def test_negative_try_reserve_protected_machine_w_password(self): self.assertTrue( machines.protect(self.example_machine["id"], password=load_spring_configuration().get( "rules").get("password")), "Response from the service should be True") r = reservations.get_specific_reservation(self.example_machine["id"]) self.assertTrue(r["protected"], "Machine should be protected")
def test_try_to_reserve_protected_machines(self): self.assertTrue( machines.protect(self.example_machine["id"], password=get_protect_password())) reservation = reservations.get_specific_reservation( self.example_machine["id"]) self.assertTrue(reservation.get("protected")) self.assertTrue(reservation.get("enabled")) self.assertTrue( self.example_machine["address"] in [x["address"] for x in reservations.get_all_reservations()]) self.assertFalse(reserve.is_reserved(self.example_machine["id"])) self.assertFalse(reserve.post_reservation(self.example_machine["id"]))