def test_init_must_write_snapcraft_yaml(self): fake_logger = fixtures.FakeLogger(level=logging.INFO) self.useFixture(fake_logger) init.main() self.assertEqual('Created snapcraft.yaml.\n', fake_logger.output)
def test_init_with_existing_snapcraft_yaml_must_fail(self): fake_logger = fixtures.FakeLogger(level=logging.ERROR) self.useFixture(fake_logger) open('snapcraft.yaml', 'w').close() with self.assertRaises(SystemExit) as raised: init.main() self.assertEqual(raised.exception.code, 1, 'Wrong exit code returned.') self.assertEqual('snapcraft.yaml already exists!\n', fake_logger.output)
def test_init_with_existing_snapcraft_yaml_must_fail(self): fake_logger = fixtures.FakeLogger(level=logging.ERROR) self.useFixture(fake_logger) open('snapcraft.yaml', 'w').close() with self.assertRaises(SystemExit) as raised: init.main() self.assertEqual(raised.exception.code, 1, 'Wrong exit code returned.') self.assertEqual( 'snapcraft.yaml already exists!\n', fake_logger.output)