← Back to team overview

openlp-core team mailing list archive

Re: [Merge] lp:~felipe-q/openlp/better-remote into lp:openlp

 

I'm sorry if this is a bit of a long comment. What you have done so far is heading in the right direction.

In save_titles_and_notes instead of:
	
	for num in range(len(notes)):
	
You could do;
	for num, note in enumerate(notes):
		...
		fn.write(note)
		
Also I think slide_no instead of num is a little more meaningful


In get_titles_and_notes can you log the exceptions in the exception blocks?


t = ['uno', 'dos']
n = ['one', 'two']

Can you give these more meaningful names. Maybe titles & notes?


Your save_titles_and_notes tests are a good start, however you're not checking that the data that you are passing in to your function is being written.
I am unsure if you should mock os.join.path (Its probably best checking with somebody else like superfly)
Presonally I would have and set its side_effect to something like:
	lambda arg1, arg2: arg1 + arg2
	
Check that mocked_open is called each time, so:
	mocked_open.assert_any_call(os.path.join('test','titles.txt'), mode='w')
	mocked_open.assert_any_call(os.path.join('test','slideNotes1.txt'), mode='w')
	mocked_open.assert_any_call(os.path.join('test','slideNotes2.txt'), mode='w')
	
You should also check that your mock_open.writelines(title) is actually called with ['uno', dos']
The same with mock_open.write(notes[num]) is called twice, once with 'one' and once with 'two'



Note: I've written the above code from memory so may need adjusting to make it work correctly
Unfortunately my lunch break is now over and I've only had time to look at you save_titles_and_notes_tests test you should be able to make similar changes to your save_titles_and_notes_with_None_and_empty_test test. I'll try and take a look at your other tests later.
-- 
https://code.launchpad.net/~felipe-q/openlp/better-remote/+merge/191897
Your team OpenLP Core is subscribed to branch lp:openlp.


References