<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<!--
This file was generated by Devel::Cover Version 1.26
Devel::Cover is copyright 2001-2012, Paul Johnson (paul@pjcj.net)
Devel::Cover is free. It is licensed under the same terms as Perl itself.
The latest version of Devel::Cover should be available from my homepage:
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<meta http-equiv="Content-Language" content="en-us"></meta>
<link rel="stylesheet" type="text/css" href="cover.css"></link>
<link rel="stylesheet" type="text/css" href="cover.css"></link>
<title>File Coverage: t/bin-user-tools.t</title>
</head>
<body>
<h1>File Coverage</h1>
<table>
<tr><td class="h" align="right">File:</td><td align="left">t/bin-user-tools.t</td></tr>
<tr><td class="h" align="right">Coverage:</td><td align="left" class="c2">92.3%</td></tr>
</table>
<div><br/></div>
<table>
<tr><th>line</th><th>stmt</th><th>bran</th><th>cond</th><th>sub</th><th>pod</th><th>time</th><th>code</th></tr>
<tr><td class="h">1</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">#!/usr/bin/env perl</td></tr>
<tr><td class="h">2</td><td><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="t-bin-user-tools-t--subroutine.html#L2">1</a></div></td><td></td><td><div>1840</div><div>3</div></td><td class="s">use 5.12.1;</td></tr>
<tr><td class="h">3</td><td colspan="7"></td></tr><tr><td class="h">4</td><td><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="t-bin-user-tools-t--subroutine.html#L4">1</a></div></td><td></td><td><div>512</div><div>454</div><div>5</div></td><td class="s">use lib 't/lib';</td></tr>
<tr><td class="h">5</td><td><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="t-bin-user-tools-t--subroutine.html#L5">1</a></div></td><td></td><td><div>526</div><div>4</div><div>2</div></td><td class="s">use Yukki::Test;</td></tr>
<tr><td class="h">6</td><td colspan="7"></td></tr><tr><td class="h">7</td><td><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="t-bin-user-tools-t--subroutine.html#L7">1</a></div></td><td></td><td><div>322</div><div>1</div><div>22</div></td><td class="s">use Path::Tiny qw( tempdir );</td></tr>
<tr><td class="h">8</td><td><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="t-bin-user-tools-t--subroutine.html#L8">1</a></div></td><td></td><td><div>3</div><div>1</div><div>3</div></td><td class="s">use Test2::V0;</td></tr>
<tr><td class="h">9</td><td><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="t-bin-user-tools-t--subroutine.html#L9">1</a></div></td><td></td><td><div>1698</div><div>7329</div><div>4</div></td><td class="s">use Test::Script;</td></tr>
<tr><td class="h">10</td><td><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="t-bin-user-tools-t--subroutine.html#L10">1</a></div></td><td></td><td><div>243</div><div>1</div><div>34</div></td><td class="s">use Try::Tiny;</td></tr>
<tr><td class="h">11</td><td><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="t-bin-user-tools-t--subroutine.html#L11">1</a></div></td><td></td><td><div>216</div><div>3078</div><div>167</div></td><td class="s">use YAML qw( LoadFile );</td></tr>
<tr><td class="h">12</td><td colspan="7"></td></tr><tr><td class="h">13</td><td><div class="c3">1</div></td><td><div class="c0" title="-/F"><a href="t-bin-user-tools-t--branch.html#L13">50</a></div></td><td></td><td></td><td></td><td><div>88707</div></td><td class="s">$File::Temp::KEEP_ALL = 1 if $ENV{YUKKI_TEST_KEEP_FILES};</td></tr>
<tr><td class="h">14</td><td colspan="7"></td></tr><tr><td class="h">15</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>3</div></td><td class="s">script_compiles('bin/yukki-setup', 'yukki-setup compiles');</td></tr>
<tr><td class="h">16</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>394397</div></td><td class="s">script_compiles('bin/yukki-add-user', 'yukki-add-user compiles');</td></tr>
<tr><td class="h">17</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>244804</div></td><td class="s">script_compiles('bin/yukki-passwd', 'yukki-passwd compiles');</td></tr>
<tr><td class="h">18</td><td colspan="7"></td></tr><tr><td class="h">19</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>261559</div></td><td class="s">my $tempdir = tempdir;</td></tr>
<tr><td class="h">20</td><td><div class="c3">1</div></td><td><div class="c0" title="-/F"><a href="t-bin-user-tools-t--branch.html#L20">50</a></div></td><td></td><td></td><td></td><td><div>678</div></td><td class="s">diag("TEMPDIR = $tempdir") if $ENV{YUKKI_TEST_KEEP_FILES};</td></tr>
<tr><td class="h">21</td><td colspan="7"></td></tr><tr><td class="h">22</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>4</div></td><td class="s">script_runs([ 'bin/yukki-setup', "$tempdir/yukki-test", 'skel' ],</td></tr>
<tr><td class="h">23</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> 'yukki-setup runs');</td></tr>
<tr><td class="h">24</td><td colspan="7"></td></tr><tr><td class="h">25</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>456063</div></td><td class="s">ok(-d "$tempdir/yukki-test", 'created the test directory');</td></tr>
<tr><td class="h">26</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>176</div></td><td class="s">ok(!-f "$tempdir/yukki-test/var/db/users/foo",</td></tr>
<tr><td class="h">27</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> 'the user we are about to create does not exist yet');</td></tr>
<tr><td class="h">28</td><td colspan="7"></td></tr><tr><td class="h">29</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>180</div></td><td class="s">$ENV{YUKKI_CONFIG} = "$tempdir/yukki-test/etc/yukki.conf";</td></tr>
<tr><td class="h">30</td><td colspan="7"></td></tr><tr><td class="h">31</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">try {</td></tr>
<tr><td class="h">32</td><td><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="t-bin-user-tools-t--subroutine.html#L32">1</a></div></td><td></td><td><div>65</div></td><td class="s"> yukki('add-user', qq[foo</td></tr>
<tr><td class="h">33</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">secret</td></tr>
<tr><td class="h">34</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">Foo Bar</td></tr>
<tr><td class="h">35</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">foo\@bar.com</td></tr>
<tr><td class="h">36</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">some_group</td></tr>
<tr><td class="h">37</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">another_group</td></tr>
<tr><td class="h">38</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">]);</td></tr>
<tr><td class="h">39</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>14</div></td><td class="s"> pass('ran yukki-add-user');</td></tr>
<tr><td class="h">40</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">41</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">catch {</td></tr>
<tr><td class="h">42</td><td><div class="c0">0</div></td><td></td><td></td><td><div class="c0"><a href="t-bin-user-tools-t--subroutine.html#L42">0</a></div></td><td></td><td><div>0</div></td><td class="s"> fail("ran yukki-add-user: $_");</td></tr>
<tr><td class="h">43</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>33</div></td><td class="s">};</td></tr>
<tr><td class="h">44</td><td colspan="7"></td></tr><tr><td class="h">45</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>521</div></td><td class="s">ok(-f "$tempdir/yukki-test/var/db/users/foo",</td></tr>
<tr><td class="h">46</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> 'the user file has been created');</td></tr>
<tr><td class="h">47</td><td colspan="7"></td></tr><tr><td class="h">48</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>201</div></td><td class="s">my $user = LoadFile("$tempdir/yukki-test/var/db/users/foo");</td></tr>
<tr><td class="h">49</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>9204</div></td><td class="s">my $password = delete $user->{password};</td></tr>
<tr><td class="h">50</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>18</div></td><td class="s">is($user, {</td></tr>
<tr><td class="h">51</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> login_name => 'foo',</td></tr>
<tr><td class="h">52</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> name => 'Foo Bar',</td></tr>
<tr><td class="h">53</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> email => 'foo@bar.com',</td></tr>
<tr><td class="h">54</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> groups => [ 'some_group', 'another_group' ],</td></tr>
<tr><td class="h">55</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}, 'the user was created correctly');</td></tr>
<tr><td class="h">56</td><td colspan="7"></td></tr><tr><td class="h">57</td><td><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="t-bin-user-tools-t--subroutine.html#L57">1</a></div><div class="c3"><a href="t-bin-user-tools-t--subroutine.html#L57">1</a></div></td><td></td><td><div>169</div><div>11587</div><div>6</div><div>536</div><div>2</div><div>2</div><div>9</div></td><td class="s">use ok('Yukki');</td></tr>
<tr><td class="h">58</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>1125</div></td><td class="s">my $app = Yukki->new;</td></tr>
<tr><td class="h">59</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>1781</div></td><td class="s">my $digest = $app->hasher;</td></tr>
<tr><td class="h">60</td><td colspan="7"></td></tr><tr><td class="h">61</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>1757</div></td><td class="s">ok(scalar $digest->validate($password, 'secret'), 'password is valid');</td></tr>
<tr><td class="h">62</td><td colspan="7"></td></tr><tr><td class="h">63</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">try {</td></tr>
<tr><td class="h">64</td><td><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="t-bin-user-tools-t--subroutine.html#L64">1</a></div></td><td></td><td><div>45</div></td><td class="s"> yukki('passwd', "foo\nMy Other Secret\n");</td></tr>
<tr><td class="h">65</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>19</div></td><td class="s"> pass("ran yukki-passwd");</td></tr>
<tr><td class="h">66</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">67</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">catch {</td></tr>
<tr><td class="h">68</td><td><div class="c0">0</div></td><td></td><td></td><td><div class="c0"><a href="t-bin-user-tools-t--subroutine.html#L68">0</a></div></td><td></td><td><div>0</div></td><td class="s"> fail("ran yukki-passwd: $_");</td></tr>
<tr><td class="h">69</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>403</div></td><td class="s">};</td></tr>
<tr><td class="h">70</td><td colspan="7"></td></tr><tr><td class="h">71</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>446</div></td><td class="s">my $user_again = LoadFile("$tempdir/yukki-test/var/db/users/foo");</td></tr>
<tr><td class="h">72</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>3058</div></td><td class="s">my $new_password = delete $user_again->{password};</td></tr>
<tr><td class="h">73</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>38</div></td><td class="s">is($user_again, {</td></tr>
<tr><td class="h">74</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> login_name => 'foo',</td></tr>
<tr><td class="h">75</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> name => 'Foo Bar',</td></tr>
<tr><td class="h">76</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> email => 'foo@bar.com',</td></tr>
<tr><td class="h">77</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> groups => [ 'some_group', 'another_group' ],</td></tr>
<tr><td class="h">78</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}, 'the user is unchanged');</td></tr>
<tr><td class="h">79</td><td colspan="7"></td></tr><tr><td class="h">80</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>1119</div></td><td class="s">ok(scalar $digest->validate($new_password, 'My Other Secret'), 'password is valid, but different');</td></tr>
<tr><td class="h">81</td><td colspan="7"></td></tr><tr><td class="h">82</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>422</div></td><td class="s">done_testing;</td></tr>
</table>
</body>
</html>