Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
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):
Esempio n. 4
0
 def test_interrupts_stdio(self):
     queue = ['hi', 'there', 'joe']
     jabber = Jabber(queue)
     self.assertEqual(raw_input(), 'hi')
     self.assertEqual(getpass.getpass(), 'there')
Esempio n. 5
0
 def test_initialization(self):
     queue = ['hi', 'there', 'joe']
     jabber = Jabber(queue)
     loaded_queue = jabber._Jabber__queue
     self.assertTrue(isinstance(loaded_queue, list))
Esempio n. 6
0
 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')
Esempio n. 7
0
 def __init__(self, jabber = None):
     self.__jabber = jabber or Jabber()
Esempio n. 8
0
 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')
Esempio n. 9
0
 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')
Esempio n. 10
0
 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')
Esempio n. 11
0
 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")
Esempio n. 12
0
 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")