~barry/ubuntu-system-image/lp1373467

« back to all changes in this revision

Viewing changes to systemimage/tests/test_dbus.py

  • Committer: Barry Warsaw
  • Date: 2015-01-15 20:04:40 UTC
  • Revision ID: barry@python.org-20150115200440-aiqab13x6veor6t6
Update documentation for -C and remove all mentions of channels.ini.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1338
1338
    mode = 'more-info'
1339
1339
 
1340
1340
    def test_info(self):
1341
 
        # .Info() with a channel.ini containing version details.
 
1341
        # .Info() with some version details.
1342
1342
        buildno, device, channel, last_update, details = self.iface.Info()
1343
1343
        self.assertEqual(buildno, 45)
1344
1344
        self.assertEqual(device, 'nexus11')
1347
1347
        self.assertEqual(details, dict(ubuntu='123', mako='456', custom='789'))
1348
1348
 
1349
1349
    def test_information(self):
1350
 
        # .Information() with a channel.ini containing version details.
 
1350
        # .Information() with some version details.
1351
1351
        response = self.iface.Information()
1352
1352
        self.assertEqual(
1353
1353
            sorted(str(key) for key in response), [
1371
1371
 
1372
1372
class TestLiveDBusInfo(_LiveTesting):
1373
1373
    def test_info_no_version_detail(self):
1374
 
        # .Info() where there is no channel.ini with version details.
 
1374
        # .Info() where there are no version details.
1375
1375
        timestamp = int(datetime(2022, 8, 1, 4, 45, 45).timestamp())
1376
1376
        touch_build(45, timestamp, self.config)
1377
1377
        self.iface.Reset()
1383
1383
        self.assertEqual(details, {})
1384
1384
 
1385
1385
    def test_information_before_check_no_details(self):
1386
 
        # .Information() where there is no channel.ini with version details,
1387
 
        # and no previous CheckForUpdate() call was made.
 
1386
        # .Information() where there are no version details, and no previous
 
1387
        # CheckForUpdate() call was made.
1388
1388
        timestamp = int(datetime(2022, 8, 1, 4, 45, 45).timestamp())
1389
1389
        touch_build(45, timestamp, self.config)
1390
1390
        self.iface.Reset()
1398
1398
        self.assertEqual(response['target_build_number'], '-1')
1399
1399
 
1400
1400
    def test_information_no_details(self):
1401
 
        # .Information() where there is no channel.ini with version details,
1402
 
        # but a previous CheckForUpdate() call was made.
 
1401
        # .Information() where there are no version details, but a previous
 
1402
        # CheckForUpdate() call was made.
1403
1403
        timestamp = int(datetime(2022, 8, 1, 4, 45, 45).timestamp())
1404
1404
        touch_build(45, timestamp, self.config)
1405
1405
        self.iface.Reset()
1427
1427
        self.assertEqual(response['target_build_number'], '1600')
1428
1428
 
1429
1429
    def test_information(self):
1430
 
        # .Information() where there is a channel.ini with version details,
1431
 
        # and a previous CheckForUpdate() call was made.
 
1430
        # .Information() where there there are version details, and a previous
 
1431
        # CheckForUpdate() call was made.
1432
1432
        timestamp = int(datetime(2022, 8, 1, 4, 45, 45).timestamp())
1433
1433
        touch_build(45, timestamp, use_config=self.config)
1434
 
        self.iface.Reset()
1435
1434
        ini_path = Path(SystemImagePlugin.controller.ini_path)
1436
 
        channel_path = ini_path.with_name('channel.ini')
1437
 
        with channel_path.open('w', encoding='utf-8') as fp:
 
1435
        override_ini = ini_path.with_name('03_override.ini')
 
1436
        with override_ini.open('w', encoding='utf-8') as fp:
1438
1437
            print("""\
1439
1438
[service]
1440
1439
version_detail: ubuntu=222,mako=333,custom=444
1441
1440
""", file=fp)
 
1441
        self.iface.Reset()
1442
1442
        # Set last_update_date.
1443
1443
        reactor = SignalCapturingReactor('UpdateAvailableStatus')
1444
1444
        reactor.run(self.iface.CheckForUpdate)