Skip to content

Commit

Permalink
try to make black happy
Browse files Browse the repository at this point in the history
  • Loading branch information
brg468 committed Dec 17, 2023
1 parent 02234d1 commit ef14292
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
12 changes: 6 additions & 6 deletions tests/test_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_list_programs(self, mock):
# Check that the mock function is called with the rights args.
self.assertEqual(
args[1], f"{VALVE_API_URL}/program/listPrograms/{valveid}"
)
)
self.assertEqual(args[0], "GET")
self.assertEqual(kwargs["data"], None)

Expand All @@ -51,7 +51,7 @@ def test_get_program(self, mock):
# Check that the mock function is called with the rights args.
self.assertEqual(
args[1], f"{VALVE_API_URL}/program/getProgram/{programid}"
)
)
self.assertEqual(args[0], "GET")
self.assertEqual(kwargs["data"], None)

Expand All @@ -70,11 +70,11 @@ def test_create_skip_overrides(self, mock):
# Check that the mock function is called with the rights args.
self.assertEqual(
args[1], f"{VALVE_API_URL}/program/createSkipOverrides"
)
)
self.assertEqual(args[0], "POST")
self.assertEqual(
kwargs["data"],
json.dumps({"programId": programid, "timestamp": timestamp})
json.dumps({"programId": programid, "timestamp": timestamp}),
)

@patch("requests.Session.request")
Expand All @@ -92,9 +92,9 @@ def test_delete_skip_overrides(self, mock):
# Check that the mock function is called with the rights args.
self.assertEqual(
args[1], f"{VALVE_API_URL}/program/deleteSkipOverrides"
)
)
self.assertEqual(args[0], "POST")
self.assertEqual(
kwargs["data"],
json.dumps({"programId": programid, "timestamp": timestamp})
json.dumps({"programId": programid, "timestamp": timestamp}),
)
6 changes: 3 additions & 3 deletions tests/test_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_get_valve_day_views(self, mock):
{
"resourceId": {"baseStationId": deviceid},
"start": start,
"end": end
"end": end,
}
)
)
),
)
28 changes: 13 additions & 15 deletions tests/test_valve.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ def test_get_base_station(self, mock):

# Check that the mock function is called with the rights args.
self.assertEqual(
args[1],
f"{VALVE_API_URL}/valve/getBaseStation/{baseid}"
)
args[1], f"{VALVE_API_URL}/valve/getBaseStation/{baseid}"
)
self.assertEqual(args[0], "GET")
self.assertEqual(kwargs["data"], None)

Expand All @@ -68,9 +67,8 @@ def test_list_base_stations(self, mock):

# Check that the mock function is called with the rights args.
self.assertEqual(
args[1],
f"{VALVE_API_URL}/valve/listBaseStations/{userid}"
)
args[1], f"{VALVE_API_URL}/valve/listBaseStations/{userid}"
)
self.assertEqual(args[0], "GET")
self.assertEqual(kwargs["data"], None)

Expand Down Expand Up @@ -107,16 +105,18 @@ def test_set_default_runtime(self, mock):
self.assertEqual(args[0], "PUT")
self.assertEqual(
kwargs["data"],
json.dumps({"valveId": valveid, "defaultRuntimeSeconds": duration})
json.dumps(
{"valveId": valveid, "defaultRuntimeSeconds": duration}
),
)

# Check that values should be within range.
self.assertRaises(
AssertionError, self.valve.start_watering, valveid, -1
)
)
self.assertRaises(
AssertionError, self.valve.start_watering, valveid, 86401
)
)

@patch("requests.Session.request")
def test_start_watering(self, mock):
Expand All @@ -135,16 +135,16 @@ def test_start_watering(self, mock):
self.assertEqual(args[0], "PUT")
self.assertEqual(
kwargs["data"],
json.dumps({"valveId": valveid, "durationSeconds": duration})
json.dumps({"valveId": valveid, "durationSeconds": duration}),
)

# Check that values should be within range.
self.assertRaises(
AssertionError, self.valve.start_watering, valveid, -1
)
)
self.assertRaises(
AssertionError, self.valve.start_watering, valveid, 86401
)
)

@patch("requests.Session.request")
def test_stop_watering(self, mock):
Expand All @@ -160,6 +160,4 @@ def test_stop_watering(self, mock):
# Check that the mock function is called with the rights args.
self.assertEqual(args[1], f"{VALVE_API_URL}/valve/stopWatering")
self.assertEqual(args[0], "PUT")
self.assertEqual(
kwargs["data"], json.dumps({"valveId": valveid})
)
self.assertEqual(kwargs["data"], json.dumps({"valveId": valveid}))

0 comments on commit ef14292

Please sign in to comment.