def test_skips_duplicate_content(self, tmpdir): self.make_keyring(tmpdir, 'foo.keyring', '[mon.1]\nkey = value\n') self.make_keyring(tmpdir, 'bar.keyring', '[mon.2]\nkey = value\n') self.make_keyring(tmpdir, 'fez.keyring', '[mon.3]\nkey = value\n') self.make_keyring(tmpdir, 'dupe.keyring', '[mon.3]\nkey = value\n') self.args.keyrings = tmpdir.strpath result = mon.concatenate_keyrings(self.args).split('\n') assert result.count('[mon.3]') == 1 assert result.count('[mon.2]') == 1 assert result.count('[mon.1]') == 1
def test_multiple_keyrings_work(self, tmpdir): self.make_keyring(tmpdir, 'foo.keyring', '[mon.1]\nkey = value\n') self.make_keyring(tmpdir, 'bar.keyring', '[mon.2]\nkey = value\n') self.make_keyring(tmpdir, 'fez.keyring', '[mon.3]\nkey = value\n') self.args.keyrings = tmpdir.strpath result = mon.concatenate_keyrings(self.args).split('\n') assert '[mon.2]' in result assert 'key = value' in result assert '[mon.3]' in result assert 'key = value' in result assert '[mon.1]' in result assert 'key = value' in result
def test_errors_when_no_keyrings(self, tmpdir): self.args.keyrings = tmpdir.strpath with py.test.raises(RuntimeError): mon.concatenate_keyrings(self.args)