Esempio n. 1
0
    def test_unknown_actino(self):
        printer = Octoprint(
            "900c73b8-1f12-4027-941a-e4b29531e8e3",
            ip="192.168.1.15",
            client_props={"connected": True},
        )
        with self.assertRaises(Exception) as ctx:
            printer.modify_current_job("random")

        self.assertTrue("random is not allowed" in str(ctx.exception))
Esempio n. 2
0
 def test_modify_job_disconnect(self, mock_post_uri):
     printer = Octoprint(
         "900c73b8-1f12-4027-941a-e4b29531e8e3",
         "d501f4f0-48d5-468e-a137-1f3803cd836c",
         UUID_ORG,
         ip="192.168.1.15",
         client_props={"connected": True},
     )
     printer.modify_current_job("toggle")
     # testing connected = Flase
     self.assertFalse(printer.client_info.connected)  
Esempio n. 3
0
 def test_modify_job_no_response(self, mock_post_uri):
     printer = Octoprint(
         "900c73b8-1f12-4027-941a-e4b29531e8e3",
         ip="192.168.1.15",
         client_props={"connected": True},
     )
     result = printer.modify_current_job("toggle")
     self.assertFalse(result)
Esempio n. 4
0
 def test_modify_job_inactive_printer(self, mock_post_uri):
     printer = Octoprint(
         "900c73b8-1f12-4027-941a-e4b29531e8e3",
         "d501f4f0-48d5-468e-a137-1f3803cd836c",
         UUID_ORG,
         ip="192.168.1.15",
     )
     self.assertEqual(mock_post_uri.call_count, 0)
     result = printer.modify_current_job("toggle")
     self.assertFalse(result)
Esempio n. 5
0
 def test_modify_job_cancel_ok(self, mock_post_uri):
     mock_post_uri.return_value.status_code = 204
     printer = Octoprint(
         "900c73b8-1f12-4027-941a-e4b29531e8e3",
         ip="192.168.1.15",
         client_props={"connected": True},
     )
     result = printer.modify_current_job("cancel")
     self.assertTrue(result)
     args, kwargs = mock_post_uri.call_args
     self.assertEqual(kwargs["json"], {"command": "cancel"})
Esempio n. 6
0
 def test_modify_job_toggle_ok(self, mock_post_uri):
     mock_post_uri.return_value.status_code = 204
     printer = Octoprint(
         "900c73b8-1f12-4027-941a-e4b29531e8e3",
         "d501f4f0-48d5-468e-a137-1f3803cd836c",
         UUID_ORG,
         ip="192.168.1.15",
         client_props={"connected": True},
     )
     result = printer.modify_current_job("toggle")
     self.assertTrue(result)
     args, kwargs = mock_post_uri.call_args
     self.assertEqual(kwargs["json"], {"command": "pause", "action": "toggle"})
Esempio n. 7
0
 def test_modify_job_inactive_printer(self, mock_post_uri):
     printer = Octoprint("900c73b8-1f12-4027-941a-e4b29531e8e3",
                         ip="192.168.1.15")
     self.assertEqual(mock_post_uri.call_count, 0)
     result = printer.modify_current_job("toggle")
     self.assertFalse(result)