def test_timeout(): db = CCRAttendance.open_db_interface(res("client_secret.json"), "Node", res("db_config.json")) db.clear_attendence_log() db.log_swipe_in("Lucas", "Merc", "Merc") db.log_timeout(2) assert db.get_active_users() == []
def test_swipe_in_multi(): db = CCRAttendance.open_db_interface(res("client_secret.json"), "Node", res("db_config.json")) db.clear_attendence_log() db.log_swipe_in("Lucas", "Merc", "Merc") db.log_swipe_in("Lucas2", "Merc", "Merv") assert db.get_active_users()[0]["user"] == "Lucas" and db.get_active_users( )[1]["user"] == "Lucas2"
def test_swipe_in_multi(): db = CCRAttendance.open_db_interface(res("client_secret.json"), "Node", res("db_config.json")) db.clear_attendence_log() db.log_swipe_in(123, "Name", "Merc", "Merc") db.log_swipe_in(456, "Name", "Merc", "Merc") assert int(db.get_active_users()[0]["id"]) == 123 and int( db.get_active_users()[1]["id"]) == 456
def do_connect(): try: global node global meetings global projects node = CCRAttendanceNode(res("client_secret.json"), "CCR_Attendance_Node", res("db_config.json")) meetings = node.get_meetings() projects = node.get_projects() except Exception: time.sleep(10) print "Failed to connect. Trying again in 10 seconds." do_connect()
def get_credentials(clientSecret, applicationName, scope): credential_dir = res(".credentials") if not os.path.exists(credential_dir): os.makedirs(credential_dir) credential_path = os.path.join(credential_dir, CREDENTIAL_FILE_NAME) store = Storage(credential_path) credentials = store.get() if not credentials or credentials.invalid: flow = client.flow_from_clientsecrets(clientSecret, scope) flow.user_agent = applicationName credentials = tools.run_flow(flow, store) print('Storiabotng credentials to ' + credential_path) return credentials
currentUser.name = name currentUser.id = id if node.is_user_swiped_in(id): node.log_swipe_out(id) self.manager.current = "goodbye" else: self.manager.current = "meeting" class ScreenManagement(ScreenManager): pass do_connect() presentation = Builder.load_file(res("gui.kv")) class CCRAttendanceApp(App): def build(self): return presentation def reload_meetings_and_projects(self): global projects global meetings projects = node.db.get_projects_list() meetings = node.db.get_meetings_list() CCRAttendanceApp().run()
rgba: 1, 1, 1, 1 BoxLayout: id: teams_box orientation : "vertical" Label: text: root.team_message color: 0,0,0,1 font_size: 60 Label: text: "Which subteam are you on?" color: 0,0,0,1 font_size: 30 ''' currentUser = User() node = CCRAttendanceNode(res("client_secret.json"), "CCR_Attendance_Node", res("db_config.json")) #node.start_swipe_logging_job() projects = node.db.get_projects_list() meetings = node.db.get_meetings_list() class DoneScreen(Screen): def __init__(self, **kwargs): super(DoneScreen, self).__init__(**kwargs) global currentUser self.done_message = currentUser.greeting currentUser = User() def on_enter(self): Clock.schedule_once(self.switch, 3)
def test_swipe_queue_empty(): node = CCRAttendanceNode(res("client_secret.json"), "Node", res("db_config.json")) node.queue_swipe({"flag": "test"}) node.pop_swipe() assert not node.has_swipe_available()
def test_swipe_dequeue(): node = CCRAttendanceNode(res("client_secret.json"), "Node", res("db_config.json")) node.queue_swipe({"flag": "test"}) swipe = node.pop_swipe() assert swipe == ({"flag": "test"})
def test_meetings_list(): db = CCRAttendance.open_db_interface(res("client_secret.json"), "Node", res("db_config.json")) projects = db.get_meetings_list() assert projects == ["Dave", "Saturday Work"]
def test_projects_list(): db = CCRAttendance.open_db_interface(res("client_secret.json"), "Node", res("db_config.json")) projects = db.get_projects_list() assert projects == ["Minibot", "Vision", "Merc"]
def __init__(self,service, configFile): self._service = service self._configFile = configFile self.config_schema = json.load(open(res("config_schema.json"))) self.reload_config_file()