示例#1
0
 def test_fetch_cumilitive_reading_year(self, mock_post, mock_get):
     ue = UnitedEnergy("test_un", "test_pwd", True)
     results = ue.fetch_cumilitive_reading(ReportPeriod.year,
                                           PeriodOffset.current)
     assert results["price"] == 542.2389441
     assert results["timestamp"] == "2019-10"
     assert results["total"] == 3340.967
示例#2
0
 def test_fetch_cumilitive_reading_day(self, mock_post, mock_get):
     ue = UnitedEnergy("test_un", "test_pwd", True)
     results = ue.fetch_cumilitive_reading(ReportPeriod.day,
                                           PeriodOffset.current)
     assert results["price"] == 1.6528631999999999
     assert results["timestamp"] == "2019-11-11 20:00"
     assert results["total"] == 10.183999999999997
示例#3
0
 def test_fetch_cumilitive_reading_month(self, mock_post, mock_get):
     ue = UnitedEnergy("test_un", "test_pwd", True)
     results = ue.fetch_cumilitive_reading(ReportPeriod.month,
                                           PeriodOffset.timebeforelast)
     assert results["price"] == 87.37647719999998
     assert results["timestamp"] == "2019-9-29"
     assert results["total"] == 538.364
示例#4
0
 def test_fetch_last_reading(self, mock_post, mock_get):
     ue = UnitedEnergy("test_un", "test_pwd", True)
     results = ue.fetch_last_reading(ReportPeriod.day, PeriodOffset.current)
     assert results["price"] == 0.1543473
     assert results["timestamp"] == "2019-11-11 20:00"
     assert results["total"] == 0.951
示例#5
0
 def test_fetch_recent_reformat_usage(self, mock_post, mock_get):
     ue = UnitedEnergy("test_un", "test_pwd", True)
     results = ue.fetch_recent_usage_data_and_reformat(
         ReportPeriod.day, PeriodOffset.current)
     assert len(results) == 24
示例#6
0
 def test_fetch_recent_usage(self, mock_post, mock_get):
     ue = UnitedEnergy("test_un", "test_pwd", True)
     results = ue.fetch_recent_usage_data(ReportPeriod.day,
                                          PeriodOffset.current)
     assert results["latestInterval"] == "2019-11-11:42"
示例#7
0
 def test_get_meters(self, mock_post, mock_get):
     ue = UnitedEnergy("test_un", "test_pwd", True)
     results = ue.get_meters()
     assert len(results) == 1
     assert results[0] == "1234567"
示例#8
0
 def test_login_fail(self, mock_post):
     with pytest.raises(UnitedEnergyError):
         ue = UnitedEnergy("test_un", "test_pwd", True)
         assert ue.password is "test_pwd"
         assert ue.username is "test_un"
示例#9
0
 def test_login_pass(self, mock_post):
     ue = UnitedEnergy("test_un", "test_pwd", True)
     assert ue.password is "test_pwd"
     assert ue.username is "test_un"