MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_sources

Function test_sources

tests/test_reckless.py:182–216  ·  view source on GitHub ↗

add additional sources and search through them

(node_factory)

Source from the content-addressed store, hash-verified

180
181
182def test_sources(node_factory):
183 """add additional sources and search through them"""
184 n = get_reckless_node(node_factory)
185 r = reckless(["source", "-h"], dir=n.lightning_dir)
186 assert r.returncode == 0
187 r = reckless(["source", "list"], dir=n.lightning_dir)
188 print(r.stdout)
189 assert r.returncode == 0
190 print(n.lightning_dir)
191 reckless_dir = Path(n.lightning_dir) / 'reckless'
192 print(dir(reckless_dir))
193 assert (reckless_dir / '.sources').exists()
194 print(os.listdir(reckless_dir))
195 print(reckless_dir / '.sources')
196 plugin_dir = str(os.path.join(n.lightning_dir, '..', 'lightningd'))
197 r = reckless([f"--network={NETWORK}", "-v", "source", "add",
198 f'{plugin_dir}/testplugfail'],
199 dir=n.lightning_dir)
200 r = reckless([f"--network={NETWORK}", "-v", "source", "add",
201 f'{plugin_dir}/testplugpass'],
202 dir=n.lightning_dir)
203 with open(reckless_dir / '.sources') as sources:
204 contents = [c.strip() for c in sources.readlines()]
205 print('contents:', contents)
206 assert 'https://github.com/lightningd/plugins' in contents
207 assert f'{plugin_dir}/testplugfail' in contents
208 assert f'{plugin_dir}/testplugpass' in contents
209 r = reckless([f"--network={NETWORK}", "-v", "source", "remove",
210 f'{plugin_dir}/testplugfail'],
211 dir=n.lightning_dir)
212 with open(reckless_dir / '.sources') as sources:
213 contents = [c.strip() for c in sources.readlines()]
214 print('contents:', contents)
215 assert f'{plugin_dir}/testplugfail' not in contents
216 assert f'{plugin_dir}/testplugpass' in contents
217
218
219def test_search(node_factory):

Callers

nothing calls this directly

Calls 3

get_reckless_nodeFunction · 0.85
joinMethod · 0.80
recklessFunction · 0.70

Tested by

no test coverage detected