def test_readline(self): queue = ['hi', 'there', 'joe'] jabber = Jabber(queue) self.assertEqual(jabber.readline(), 'hi') self.assertEqual(jabber.readline(), 'there') self.assertEqual(jabber.readline(), 'joe') self.assertEqual(jabber.readline(), None)
import gpio import json import time import datetime from HIH6130 import Temperature from noaa import Forecast from jabber import Jabber from config import configuration from bottle import Bottle, HTTPResponse, static_file, get, put, request, response, template instance_name = configuration.get('instance_name') temperature = Temperature() forecast = Forecast() jabber_service = Jabber(configuration.get('xmpp_username'), configuration.get('xmpp_password'), temperature) application = Bottle() application.install(temperature) application.install(forecast) #FIXME Right now two clients (like garagesec and sprinkler) can't co-exist #application.install(jabber_service) @application.route('/favicon.ico') def send_favicon(): return static_file('favicon.ico', root='views/images') @application.route('/installed/<filename:path>') def send_bower(filename):
def test_interrupts_stdio(self): queue = ['hi', 'there', 'joe'] jabber = Jabber(queue) self.assertEqual(raw_input(), 'hi') self.assertEqual(getpass.getpass(), 'there')
def test_initialization(self): queue = ['hi', 'there', 'joe'] jabber = Jabber(queue) loaded_queue = jabber._Jabber__queue self.assertTrue(isinstance(loaded_queue, list))
def test_ask_for_new_url_with_jabber(self): jabber = Jabber(['whee.com']) new_display = Display(jabber) expected = new_display.ask_for_new_url() self.assertEqual(expected, 'whee.com')
def __init__(self, jabber = None): self.__jabber = jabber or Jabber()
def test_ask_for_title_with_jabber(self): jabber = Jabber(['Love Conquers All']) new_display = Display(jabber) expected = new_display.ask_for_title() self.assertEqual(expected, 'Love Conquers All')
def test_ask_which_account_with_jabber(self): jabber = Jabber(['1300']) new_display = Display(jabber) account = Account('url', 'username', 'password') expected = new_display.ask_which_account([account], 17) self.assertEqual(expected, '1300')
def test_ask_for_new_username_with_jabber(self): jabber = Jabber(['microgasm']) new_display = Display(jabber) expected = new_display.ask_for_new_username() self.assertEqual(expected, 'microgasm')
def test_ask_for_temp_password_with_jabber(self): jabber = Jabber(['a temporary password']) new_display = Display(jabber) account = Account('hi', 'there', None) expected = new_display.ask_for_temp_password(account) self.assertEqual(expected, "a temporary password")
def test_ask_for_new_password_with_jabber(self): jabber = Jabber(['test']) new_display = Display(jabber) expected = new_display.ask_for_new_password() self.assertEqual(expected, "test")