Skip to content

Commit

Permalink
test: run multi install in non interactive mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nobkd committed Oct 10, 2023
1 parent 3dbf1f6 commit caff2cd
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions test/07_install_multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,38 @@
import pexpect
import subprocess

c = pexpect.spawn('./bin/opi -m android-tools yandex-disk', logfile=sys.stdout.buffer, echo=False)
c = pexpect.spawn('./bin/opi -nm zfs resilio-sync html2text yandex-disk', logfile=sys.stdout.buffer, echo=False)

# plugins are installed first
c.expect('Do you want to install')
c.sendline('y')

c.expect('Do you want to install resilio-sync')
c.expect('Import package signing key', timeout=10)
c.sendline('y')

c.expect('Continue')
c.sendline('y')
c.expect('Do you want to keep', timeout=500)

c.expect('Do you want to install yandex-disk')
c.expect('Import package signing key', timeout=10)
c.expect('Continue')
c.expect('Do you want to keep', timeout=500)
c.sendline('y')

# packages come after plugins
c.expect(r'([0-9]+)\. android-tools', timeout=10)
entry_id = c.match.groups()[0]
print(f'PEXPECT: Found entry id {entry_id!r}')
c.expect(r'([0-9]+)\. zfs', timeout=10)
c.expect('Pick a number')
c.sendline(entry_id)
c.expect(r'([0-9]+)\. [^ ]*(filesystems)', timeout=10)
c.expect('Adding repo \'filesystems\'', timeout=10)
c.expect('Continue?', timeout=20)

c.expect(r'([0-9]+)\. html2text', timeout=10)
c.expect('Pick a number')
c.expect(r'([0-9]+)\. [^ ]*(openSUSE-Tumbleweed-Oss|Main Repository)', timeout=10)
entry_id = c.match.groups()[0]
print(f'PEXPECT: Found entry id {entry_id!r}')
c.sendline(entry_id)

c.expect('Installing from existing repo', timeout=10)
c.expect('Continue?', timeout=20)
c.sendline('y')

c.interact()
c.wait()
c.close()
print()
assert c.exitstatus == 0, f'Exit code: {c.exitstatus}'
subprocess.check_call(['rpm', '-qi', 'resilio-sync'])
subprocess.check_call(['rpm', '-qi', 'yandex-disk'])
subprocess.check_call(['rpm', '-qi', 'android-tools'])
subprocess.check_call(['rpm', '-qi', 'zfs'])
subprocess.check_call(['rpm', '-qi', 'html2text'])

0 comments on commit caff2cd

Please sign in to comment.