Changeset c386390
- Timestamp:
- 2021-03-29T13:01:22Z (4 years ago)
- Children:
- b9b29f3
- Parents:
- cb80802
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
.github/workflows/ci.yml
rcb80802 rc386390 38 38 ./.tests/setup_bitlbee.sh 39 39 40 python3 ./.tests/jabber_connect.py 40 41 41 42 ./.tests/cleanup_bitlbee.sh -
.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) -
.tests/cleanup_bitlbee.sh
rcb80802 rc386390 4 4 5 5 killall bitlbee 6 7 printf '\n\nBitlbee output:\n\n' 6 8 less ./debuglog 7 9 -
.tests/talk_to_bitlbee.py
rcb80802 rc386390 1 1 import btlib 2 2 3 FUN = [ 4 "Did I ask you something?", 5 "Oh yeah, that's right.", 6 "Alright, alright. Now go back to work.", 7 "Buuuuuuuuuuuuuuuurp... Excuse me!", 8 "Yes?", 9 "No?", 10 ] 11 12 def yes_test(clis): 13 ret = False 14 clis[0].send_priv_msg("&bitlbee", "yes") 15 clis[0].receive() 16 for x, fun in enumerate(FUN): 17 if (clis[0].log.find(fun) != -1): 18 ret = True 19 if x: 20 print("The RNG gods smile upon us") 21 break 3 def talk_to_bitlbee(clis): 4 ret = True 5 ret = ret & btlib.connect_test(clis) 6 ret = ret & btlib.yes_test(clis) 22 7 return ret 23 8 24 btlib.perform_test( yes_test)9 btlib.perform_test(btlib.talk_to_bitlbee)
Note: See TracChangeset
for help on using the changeset viewer.