Changeset c386390


Ignore:
Timestamp:
2021-03-29T13:01:22Z (4 years ago)
Author:
/ <>
Children:
b9b29f3
Parents:
cb80802
Message:

moar

Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • .github/workflows/ci.yml

    rcb80802 rc386390  
    3838        ./.tests/setup_bitlbee.sh
    3939
     40        python3 ./.tests/jabber_connect.py
    4041
    4142        ./.tests/cleanup_bitlbee.sh
  • .tests/btlib.py

    rcb80802 rc386390  
    44import select
    55
     6FUN = [
     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
    615SEPARATOR = "="*60
    7 SMOLPARATOR = "-"*60
    816
    917class IrcClient:
     
    3846
    3947        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
    4449
    4550        self.send_raw('USER ' + (self.nick + " ")*3)
    4651        self.send_raw('NICK ' + self.nick)
    4752        self.send_raw('JOIN &bitlbee')
     53        return True
    4854
    4955    def jabber_login(self):
     
    5359        time.sleep(1)
    5460        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):
    6062
    6163    def receive(self):
     
    9193    return received
    9294
    93 
    9495def perform_test(test_function):
    9596    clis = []
    9697    clis += [IrcClient('test1', 'asd')]
    9798    clis += [IrcClient('test2', 'asd')]
    98     for cli in clis:
    99         cli.connect()
    10099
    101100    fail = not test_function(clis)
     
    108107    print(SEPARATOR)
    109108   
    110 
    111109    if fail:
    112110        sys.exit(1)
    113111
     112def connect_test(clis):
     113    ret = True
     114    for cli in clis:
     115        ret = ret & cli.connect()
     116    return ret
    114117
    115118def yes_test(clis):
     
    125128    return ret
    126129
     130def jabber_login_test(clis):
     131    ret = True
     132    for cli in clis:
     133        ret = ret & cli.jabber_login()
     134    return ret
     135
    127136def add_buddy_test(clis):
    128137    clis[0].add_jabber_buddy(clis[1].nick)
  • .tests/cleanup_bitlbee.sh

    rcb80802 rc386390  
    44
    55killall bitlbee
     6
     7printf '\n\nBitlbee output:\n\n'
    68less ./debuglog
    79
  • .tests/talk_to_bitlbee.py

    rcb80802 rc386390  
    11import btlib
    22
    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
     3def talk_to_bitlbee(clis):
     4    ret = True
     5    ret = ret & btlib.connect_test(clis)
     6    ret = ret & btlib.yes_test(clis)
    227    return ret
    238
    24 btlib.perform_test(yes_test)
     9btlib.perform_test(btlib.talk_to_bitlbee)
Note: See TracChangeset for help on using the changeset viewer.