Changeset c386390 for .tests/btlib.py
- Timestamp:
- 2021-03-29T13:01:22Z (4 years ago)
- Children:
- b9b29f3
- Parents:
- cb80802
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
.tests/btlib.py
rcb80802 rc386390 4 4 import select 5 5 6 FUN = [ 7 "Did I ask you something?", 8 "Oh yeah, that's right.", 9 "Alright, alright. Now go back to work.", 10 "Buuuuuuuuuuuuuuuurp... Excuse me!", 11 "Yes?", 12 "No?", 13 ] 14 6 15 SEPARATOR = "="*60 7 SMOLPARATOR = "-"*608 16 9 17 class IrcClient: … … 38 46 39 47 if not connected: 40 print("IRC connection failed for " + self.nick) 41 sys.exit(1) 42 43 print("IRC connection established for " + self.nick) 48 return False 44 49 45 50 self.send_raw('USER ' + (self.nick + " ")*3) 46 51 self.send_raw('NICK ' + self.nick) 47 52 self.send_raw('JOIN &bitlbee') 53 return True 48 54 49 55 def jabber_login(self): … … 53 59 time.sleep(1) 54 60 self.receive() 55 if self.log.find('Logged in') == -1: 56 print("Jabber login failed for " + self.nick) 57 sys.exit(1) 58 else: 59 print("Jabber login successful for " + self.nick) 61 return (self.log.find('Logged in') != -1): 60 62 61 63 def receive(self): … … 91 93 return received 92 94 93 94 95 def perform_test(test_function): 95 96 clis = [] 96 97 clis += [IrcClient('test1', 'asd')] 97 98 clis += [IrcClient('test2', 'asd')] 98 for cli in clis:99 cli.connect()100 99 101 100 fail = not test_function(clis) … … 108 107 print(SEPARATOR) 109 108 110 111 109 if fail: 112 110 sys.exit(1) 113 111 112 def connect_test(clis): 113 ret = True 114 for cli in clis: 115 ret = ret & cli.connect() 116 return ret 114 117 115 118 def yes_test(clis): … … 125 128 return ret 126 129 130 def jabber_login_test(clis): 131 ret = True 132 for cli in clis: 133 ret = ret & cli.jabber_login() 134 return ret 135 127 136 def add_buddy_test(clis): 128 137 clis[0].add_jabber_buddy(clis[1].nick)
Note: See TracChangeset
for help on using the changeset viewer.