Example #1
0
 def test_remove_alert(self):
     """`remove_alert` should return a valid response
     """
     dweepy.set_alert(
         self.my_thing_id,
         ['*****@*****.**', '*****@*****.**'],
         test_alert_condition,
         test_key,
     )
     dweepy.remove_alert(self.my_thing_id, test_key)
Example #2
0
 def test_get_alert(self):
     """`get_alert` should return a valid response
     """
     dweepy.set_alert(
         self.my_thing_id,
         ['*****@*****.**', '*****@*****.**'],
         test_alert_condition,
         test_key,
     )
     alert = dweepy.get_alert(self.my_thing_id, test_key)
     self.assertEqual(alert['condition'], test_alert_condition)
Example #3
0
 def test_dweet_for_alert(self):
     """`dweet_for` should not raise an exception no matter what alert condition is used
     """
     dweepy.set_alert(
         self.my_thing_id,
         ['*****@*****.**', '*****@*****.**'],
         test_alert_condition,
         test_key,
     )
     dweet = dweepy.dweet_for(self.my_thing_id, {'alertValue': 11}, key=test_key)
     check_valid_dweet_response(self, dweet, skip_content=True)
     dweet = dweepy.dweet_for(self.my_thing_id, {'alertValue': 5}, key=test_key)
     check_valid_dweet_response(self, dweet, skip_content=True)
     dweet = dweepy.dweet_for(self.my_thing_id, {'alertValue': 10}, key=test_key)
     check_valid_dweet_response(self, dweet, skip_content=True)
Example #4
0
 def test_404_after_remove_alert(self):
     """`get_alert` should raise an exception if alert does not exist
     """
     dweepy.set_alert(
         self.my_thing_id,
         ['*****@*****.**', '*****@*****.**'],
         test_alert_condition,
         test_key,
     )
     dweepy.remove_alert(self.my_thing_id, test_key)
     try:
         dweepy.get_alert(self.my_thing_id, test_key)
     except dweepy.DweepyError as e:
         self.assertEqual(e.args[0], 'we couldn\'t find this')
     else:
         self.fail("shouldn't ever get called")