<feed xmlns='http://www.w3.org/2005/Atom'>
<title>freeipa.git/tests/test_ipalib, branch WIP</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/sbose/public_git/freeipa.git/'/>
<entry>
<title>text unit test should validate using installed mo file</title>
<updated>2012-04-10T22:11:48+00:00</updated>
<author>
<name>John Dennis</name>
<email>jdennis@redhat.com</email>
</author>
<published>2012-03-27T02:26:35+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/sbose/public_git/freeipa.git/commit/?id=689bea65757bae66b387acde3ffc7897e6b0ec3b'/>
<id>689bea65757bae66b387acde3ffc7897e6b0ec3b</id>
<content type='text'>
We use custom gettext classes (e.g. GettextFactory &amp;
NGettextFactory). We should exercise those classes with an installed
binary mo file to demonstrate we are actually returning the expected
translated strings for all strings defined as being translatable.

The test logic in install/po/test_i18n.py was recently enhanced to
make this type of testing easier and more complete.
tests/test_ipalib/test_text.py should import the new i18n test support
and run it.

Previously tests/test_ipalib/test_text.py made a feeble but incomplete
attempt to do the above but even that was often not run because the
test would skip because the necessary test files were not available
unless they had been manually created in the install/po subdir. It is
now possible to correct those deficiencies in the test.

This patch does the following:

* Moves the location of i18n test code and adjust references to it.
  install/po/test_i18n.py was moved to tests/i18n.py. This permits
  tests/test_ipalib/test_text.py to import the i18n test utilities
  in a clean fashion. The Makefile in install/po now calls this
  same file.

* Modfies test function in test_i18n.py to accept function pointers
  for retreiving a translation.

* Imports test_i18n.py from the install/po directory in the tree

* Creates a tmp directory for the test localedir

* Parses the current ipa.pot file in install/po and generates
  a test po and mo file with special unicode markers. It installs
  the test mo file in the tmp localedir. This is accomplished by
  calling create_po() from the test_i18n.py file.

* If any of the above does not work it raises nose.SkipTest with
  the reason, and skips the test.

* It sets up functions to get a translation and a plural translation
  via our text.GettextFactory class and text.NGettextFactory class
  respectively. This are the functions we use intenally to get
  translations. It set the localdir and lang which are used by those
  classes to match our test configuration. It then runs a validation
  test on every translation and it's plural found in the test.po file
  by calling po_file_iterate and passed it the function pointers to
  our internal routines.

* At the conclusion of the test it cleans up after itself.

Note: extraneous files are not created in the tree, only a tmp
directory is utilized.

Validating msgid's in C code was insufficient.

* Make the discovery of format conversions much more robust by authoring
  a new function parse_printf_fmt() that is able to discover each
  format conversion in a string and break it into it's individual
  subparts. One of those subparts is the argument selector index. In c
  code we need to know if the argumenet selector index is present to
  know if translator can reorder the substitution strings.

  This replaces the simplistic python_anonymous_substitutions_regexp
  which was insufficient to deal with other programming languages
  (e.g. c).

* Add get_prog_langs() function to return the set of programming
  languages a msgid appears in. This is necessar because the msdid
  validation is programming language specific.

https://fedorahosted.org/freeipa/ticket/2582
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We use custom gettext classes (e.g. GettextFactory &amp;
NGettextFactory). We should exercise those classes with an installed
binary mo file to demonstrate we are actually returning the expected
translated strings for all strings defined as being translatable.

The test logic in install/po/test_i18n.py was recently enhanced to
make this type of testing easier and more complete.
tests/test_ipalib/test_text.py should import the new i18n test support
and run it.

Previously tests/test_ipalib/test_text.py made a feeble but incomplete
attempt to do the above but even that was often not run because the
test would skip because the necessary test files were not available
unless they had been manually created in the install/po subdir. It is
now possible to correct those deficiencies in the test.

This patch does the following:

* Moves the location of i18n test code and adjust references to it.
  install/po/test_i18n.py was moved to tests/i18n.py. This permits
  tests/test_ipalib/test_text.py to import the i18n test utilities
  in a clean fashion. The Makefile in install/po now calls this
  same file.

* Modfies test function in test_i18n.py to accept function pointers
  for retreiving a translation.

* Imports test_i18n.py from the install/po directory in the tree

* Creates a tmp directory for the test localedir

* Parses the current ipa.pot file in install/po and generates
  a test po and mo file with special unicode markers. It installs
  the test mo file in the tmp localedir. This is accomplished by
  calling create_po() from the test_i18n.py file.

* If any of the above does not work it raises nose.SkipTest with
  the reason, and skips the test.

* It sets up functions to get a translation and a plural translation
  via our text.GettextFactory class and text.NGettextFactory class
  respectively. This are the functions we use intenally to get
  translations. It set the localdir and lang which are used by those
  classes to match our test configuration. It then runs a validation
  test on every translation and it's plural found in the test.po file
  by calling po_file_iterate and passed it the function pointers to
  our internal routines.

* At the conclusion of the test it cleans up after itself.

Note: extraneous files are not created in the tree, only a tmp
directory is utilized.

Validating msgid's in C code was insufficient.

* Make the discovery of format conversions much more robust by authoring
  a new function parse_printf_fmt() that is able to discover each
  format conversion in a string and break it into it's individual
  subparts. One of those subparts is the argument selector index. In c
  code we need to know if the argumenet selector index is present to
  know if translator can reorder the substitution strings.

  This replaces the simplistic python_anonymous_substitutions_regexp
  which was insufficient to deal with other programming languages
  (e.g. c).

* Add get_prog_langs() function to return the set of programming
  languages a msgid appears in. This is necessar because the msdid
  validation is programming language specific.

https://fedorahosted.org/freeipa/ticket/2582
</pre>
</div>
</content>
</entry>
<entry>
<title>Change parameters to use only default_from for dynamic default values.</title>
<updated>2012-03-28T12:04:31+00:00</updated>
<author>
<name>Jan Cholasta</name>
<email>jcholast@redhat.com</email>
</author>
<published>2012-03-15T08:32:37+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/sbose/public_git/freeipa.git/commit/?id=a2299070c86ae049fb5702a72567a820fe6eaa28'/>
<id>a2299070c86ae049fb5702a72567a820fe6eaa28</id>
<content type='text'>
Replace all occurences of create_default with equivalent default_from
and remove create_default from the framework. This is needed for
proper parameter validation, as there is no way to tell which
parameters to validate prior to calling create_default, because
create_default does not provide information about which parameters are
used for generating the default value.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace all occurences of create_default with equivalent default_from
and remove create_default from the framework. This is needed for
proper parameter validation, as there is no way to tell which
parameters to validate prior to calling create_default, because
create_default does not provide information about which parameters are
used for generating the default value.
</pre>
</div>
</content>
</entry>
<entry>
<title>Only split CSV in the client, quote instead of escaping</title>
<updated>2012-03-21T00:03:54+00:00</updated>
<author>
<name>Petr Viktorin</name>
<email>pviktori@redhat.com</email>
</author>
<published>2012-02-23T12:29:47+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/sbose/public_git/freeipa.git/commit/?id=dddebe23507749486fb09d219f0da4f483ba4e79'/>
<id>dddebe23507749486fb09d219f0da4f483ba4e79</id>
<content type='text'>
Splitting on commas is not an idempotent operation:
'a,b\,c' -&gt; ('a', 'b,c') -&gt; ('a', 'b', 'c')

That means we can't do it when the call is forwarded, so this is only
done on the CLI. The UI already sends values as a tuple.

Replace escaping in the csv parser with quoting. Quoted strings can have
embedded commas instead of having to escape them. This prevents the csv
parser from eating all escape characters.

Also, document Param's csv arguments, and update tests.

https://fedorahosted.org/freeipa/ticket/2417
https://fedorahosted.org/freeipa/ticket/2227
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Splitting on commas is not an idempotent operation:
'a,b\,c' -&gt; ('a', 'b,c') -&gt; ('a', 'b', 'c')

That means we can't do it when the call is forwarded, so this is only
done on the CLI. The UI already sends values as a tuple.

Replace escaping in the csv parser with quoting. Quoted strings can have
embedded commas instead of having to escape them. This prevents the csv
parser from eating all escape characters.

Also, document Param's csv arguments, and update tests.

https://fedorahosted.org/freeipa/ticket/2417
https://fedorahosted.org/freeipa/ticket/2227
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace float with Decimal</title>
<updated>2012-01-20T07:13:44+00:00</updated>
<author>
<name>Martin Kosek</name>
<email>mkosek@redhat.com</email>
</author>
<published>2012-01-17T10:19:00+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/sbose/public_git/freeipa.git/commit/?id=092dd8db1293599a4b7f0ab33ea43e8082ec554f'/>
<id>092dd8db1293599a4b7f0ab33ea43e8082ec554f</id>
<content type='text'>
Having float type as a base type for floating point parameters in
ipalib introduces several issues, e.g. problem with representation
or value comparison. Python language provides a Decimal type which
help overcome these issues.

This patch replaces a float type and Float parameter with a
decimal.Decimal type in Decimal parameter. A precision attribute
was added to Decimal parameter that can be used to limit a number
of decimal places in parameter representation. This approach fixes
a problem with API.txt validation where comparison of float values
may fail on different architectures due to float representation error.

In order to safely transfer the parameter value over RPC it is
being converted to string which is then converted back to
decimal.Decimal number on a server side.

https://fedorahosted.org/freeipa/ticket/2260
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Having float type as a base type for floating point parameters in
ipalib introduces several issues, e.g. problem with representation
or value comparison. Python language provides a Decimal type which
help overcome these issues.

This patch replaces a float type and Float parameter with a
decimal.Decimal type in Decimal parameter. A precision attribute
was added to Decimal parameter that can be used to limit a number
of decimal places in parameter representation. This approach fixes
a problem with API.txt validation where comparison of float values
may fail on different architectures due to float representation error.

In order to safely transfer the parameter value over RPC it is
being converted to string which is then converted back to
decimal.Decimal number on a server side.

https://fedorahosted.org/freeipa/ticket/2260
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix attempted write to attribute of read-only object.</title>
<updated>2012-01-02T08:51:26+00:00</updated>
<author>
<name>Jan Cholasta</name>
<email>jcholast@redhat.com</email>
</author>
<published>2011-11-01T12:58:05+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/sbose/public_git/freeipa.git/commit/?id=9beb467d98cb16e09fcda5ebbeb27056dfff3a2d'/>
<id>9beb467d98cb16e09fcda5ebbeb27056dfff3a2d</id>
<content type='text'>
Add new class "cachedproperty" for creating property-like attributes
that cache the return value of a method call.

Also fix few issues in the unit tests to enable them to succeed.

ticket 1959
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add new class "cachedproperty" for creating property-like attributes
that cache the return value of a method call.

Also fix few issues in the unit tests to enable them to succeed.

ticket 1959
</pre>
</div>
</content>
</entry>
<entry>
<title>Parse comma-separated lists of values in all parameter types. This can be enabled for a specific parameter by setting the "csv" option to True.</title>
<updated>2011-11-30T16:08:35+00:00</updated>
<author>
<name>Jan Cholasta</name>
<email>jcholast@redhat.com</email>
</author>
<published>2011-11-21T15:50:27+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/sbose/public_git/freeipa.git/commit/?id=135ccf89de866ea2cdda96993ed2743394e1e716'/>
<id>135ccf89de866ea2cdda96993ed2743394e1e716</id>
<content type='text'>
Remove "List" parameter type and replace all occurences of it with appropriate
multi-valued parameter ("Str" in most cases) with csv enabled.

Add new parameter type "Any", capable of holding values of any type. This is
needed by the "batch" command, as "Str" is not suitable type for the "methods"
parameter.

ticket 2007
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove "List" parameter type and replace all occurences of it with appropriate
multi-valued parameter ("Str" in most cases) with csv enabled.

Add new parameter type "Any", capable of holding values of any type. This is
needed by the "batch" command, as "Str" is not suitable type for the "methods"
parameter.

ticket 2007
</pre>
</div>
</content>
</entry>
<entry>
<title>Finalize plugin initialization on demand.</title>
<updated>2011-11-22T05:52:24+00:00</updated>
<author>
<name>Jan Cholasta</name>
<email>jcholast@redhat.com</email>
</author>
<published>2011-11-03T10:42:17+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/sbose/public_git/freeipa.git/commit/?id=e7a6d1055574d2dd892f414dbe993ee5782ab488'/>
<id>e7a6d1055574d2dd892f414dbe993ee5782ab488</id>
<content type='text'>
This patch changes the way plugins are initialized. Instead of
finalizing all the plugins at once, plugins are finalized only after
they are accessed (currently applies to Command, Object and
Attribute subclasses, only in CLI by default).

This change provides significant performance boost, as only the
plugins that are actually used are finalized.

ticket 1336
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch changes the way plugins are initialized. Instead of
finalizing all the plugins at once, plugins are finalized only after
they are accessed (currently applies to Command, Object and
Attribute subclasses, only in CLI by default).

This change provides significant performance boost, as only the
plugins that are actually used are finalized.

ticket 1336
</pre>
</div>
</content>
</entry>
<entry>
<title>ticket 1600 - convert unittests to use DN objects</title>
<updated>2011-08-17T03:52:26+00:00</updated>
<author>
<name>John Dennis</name>
<email>jdennis@redhat.com</email>
</author>
<published>2011-08-10T01:21:56+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/sbose/public_git/freeipa.git/commit/?id=2673782aec632e84e89e8963b59cca8f62dafd47'/>
<id>2673782aec632e84e89e8963b59cca8f62dafd47</id>
<content type='text'>
We have a larger goal of replacing all DN creation via string
formatting/concatenation with DN object operations because string
operations are not a safe way to form a DN nor to compare a DN. This
work needs to be broken into smaller chunks for easier review and
testing.

Addressing the unit tests first makes sense because we don't want to
be modifying both the core code and the tests used to verify the core
code simultaneously. If we modify the unittests first with existing
core code and no regressions are found then we can move on to
modifying parts of the core code with the belief the unittests can
validate the changes in the core code. Also by doing the unittests
first we also help to validate the DN objects are working correctly
(although they do have an extensive unittest).

The fundamental changes are:

* replace string substitution &amp; concatenation with DN object
  constructor

* when comparing dn's the comparision is done after promotion
  to a DN object, then two DN objects are compared

* when a list of string dn's are to be compared a new list is
  formed where each string dn is replaced by a DN object

* because the unittest framework accepts a complex data structure of
  expected values where dn's are represeted as strings the unittest
  needs to express the expected value of a dn as a callable object
  (e.g. a lambda expression) which promotes the dn string to a DN
  object in order to do the comparision.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We have a larger goal of replacing all DN creation via string
formatting/concatenation with DN object operations because string
operations are not a safe way to form a DN nor to compare a DN. This
work needs to be broken into smaller chunks for easier review and
testing.

Addressing the unit tests first makes sense because we don't want to
be modifying both the core code and the tests used to verify the core
code simultaneously. If we modify the unittests first with existing
core code and no regressions are found then we can move on to
modifying parts of the core code with the belief the unittests can
validate the changes in the core code. Also by doing the unittests
first we also help to validate the DN objects are working correctly
(although they do have an extensive unittest).

The fundamental changes are:

* replace string substitution &amp; concatenation with DN object
  constructor

* when comparing dn's the comparision is done after promotion
  to a DN object, then two DN objects are compared

* when a list of string dn's are to be compared a new list is
  formed where each string dn is replaced by a DN object

* because the unittest framework accepts a complex data structure of
  expected values where dn's are represeted as strings the unittest
  needs to express the expected value of a dn as a callable object
  (e.g. a lambda expression) which promotes the dn string to a DN
  object in order to do the comparision.
</pre>
</div>
</content>
</entry>
<entry>
<title>ticket 1569 - Test DN object non-latin Unicode support</title>
<updated>2011-08-17T03:28:31+00:00</updated>
<author>
<name>John Dennis</name>
<email>jdennis@redhat.com</email>
</author>
<published>2011-08-03T23:26:19+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/sbose/public_git/freeipa.git/commit/?id=b6006f78f0e513b719ccf11831b8008516e0ef5e'/>
<id>b6006f78f0e513b719ccf11831b8008516e0ef5e</id>
<content type='text'>
The DN unittest was lacking a test for i18n. The unittest was
updated to store "Hello" in Arabic with both utf-8 and unicode
and verify the values could be properly retrieved and converted
to dn string syntax.

During the testing a few problems were discovered and corrected.

* passing in utf-8 caused an ASCII decode error becuase of Python's
  silly default encoding of ASCII. The fix was to explictly use
  the utf-8 codec.

* there were a couple of places where encode/decode were not
  called correctly.

* the internal attr and value members of the AVA class were renamed
  to explicitly show they are stored as unicode.

Of course the unittest was updated as well.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The DN unittest was lacking a test for i18n. The unittest was
updated to store "Hello" in Arabic with both utf-8 and unicode
and verify the values could be properly retrieved and converted
to dn string syntax.

During the testing a few problems were discovered and corrected.

* passing in utf-8 caused an ASCII decode error becuase of Python's
  silly default encoding of ASCII. The fix was to explictly use
  the utf-8 codec.

* there were a couple of places where encode/decode were not
  called correctly.

* the internal attr and value members of the AVA class were renamed
  to explicitly show they are stored as unicode.

Of course the unittest was updated as well.
</pre>
</div>
</content>
</entry>
<entry>
<title>ticket 1568 - DN objects should support the insert method</title>
<updated>2011-08-17T03:25:01+00:00</updated>
<author>
<name>John Dennis</name>
<email>jdennis@redhat.com</email>
</author>
<published>2011-08-03T23:14:51+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/sbose/public_git/freeipa.git/commit/?id=fae07f8154c9794fa94e94faf3eb1ad56fe01928'/>
<id>fae07f8154c9794fa94e94faf3eb1ad56fe01928</id>
<content type='text'>
Add dn.insert() and update unittest
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add dn.insert() and update unittest
</pre>
</div>
</content>
</entry>
</feed>
