LOL, indeed I meant to really compare something in the test. Thanks for the catch -- please take a look?
On 13.01.20 19:29, Drew Freiberger wrote:
> Review: Approve
>
> I've run unit tests with my suggestion on testing the content below. Content fine as is, but would recommend the additional test.
>
> Thanks for the commit!
>
> Diff comments:
>
>> diff --git a/tests/unit/test_libsudopair.py b/tests/unit/test_libsudopair.py
>> index ecd1e41..d983900 100644
>> --- a/tests/unit/test_libsudopair.py
>> +++ b/tests/unit/test_libsudopair.py
>> @@ -147,6 +147,13 @@ class TestSudoPairHelper():
>> sph.create_socket_dir()
>> assert os.path.exists(tmpdir.join('/var/run/sudo_pair'))
>>
>> + def test_create_tmpfiles_conf(self, sph, tmpdir):
>> + sph.create_tmpfiles_conf()
>> + expected_content = ''
>
> I'd really like to see this check some amount of the content of the return to make sure the function is still able to be properly mocked out with the read/write.
>
> expected_content = "d {} 0755 - - -\n".format(sph.socket_dir)
>
>> + with open(tmpdir.join('/usr/lib/tmpfiles.d/sudo_pair.conf')) as f:
>> + content = f.read()
>> + assert expected_content in content
>
> assert expected_content == content
>
>> +
>> def test_install_sudo_pair_so(self, sph, tmpdir):
>> sph.install_sudo_pair_so()
>> assert filecmp.cmp('./files/sudo_pair.so', tmpdir.join('/usr/lib/sudo/sudo_pair.so'))
>
>
LOL, indeed I meant to really compare something in the test. Thanks for the catch -- please take a look?
On 13.01.20 19:29, Drew Freiberger wrote: unit/test_ libsudopair. py b/tests/ unit/test_ libsudopair. py unit/test_ libsudopair. py unit/test_ libsudopair. py per(): socket_ dir() exists( tmpdir. join('/ var/run/ sudo_pair' )) tmpfiles_ conf(self, sph, tmpdir): tmpfiles_ conf() sph.socket_ dir) join('/ usr/lib/ tmpfiles. d/sudo_ pair.conf' )) as f: sudo_pair_ so(self, sph, tmpdir): sudo_pair_ so() cmp('./ files/sudo_ pair.so' , tmpdir. join('/ usr/lib/ sudo/sudo_ pair.so' ))
> Review: Approve
>
> I've run unit tests with my suggestion on testing the content below. Content fine as is, but would recommend the additional test.
>
> Thanks for the commit!
>
> Diff comments:
>
>> diff --git a/tests/
>> index ecd1e41..d983900 100644
>> --- a/tests/
>> +++ b/tests/
>> @@ -147,6 +147,13 @@ class TestSudoPairHel
>> sph.create_
>> assert os.path.
>>
>> + def test_create_
>> + sph.create_
>> + expected_content = ''
>
> I'd really like to see this check some amount of the content of the return to make sure the function is still able to be properly mocked out with the read/write.
>
> expected_content = "d {} 0755 - - -\n".format(
>
>> + with open(tmpdir.
>> + content = f.read()
>> + assert expected_content in content
>
> assert expected_content == content
>
>> +
>> def test_install_
>> sph.install_
>> assert filecmp.
>
>