Skip to content

Commit

Permalink
add tests for jedie#57, changes text
Browse files Browse the repository at this point in the history
  • Loading branch information
LegoStormtroopr committed Feb 1, 2016
1 parent 931b3f5 commit e02f611
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
12 changes: 8 additions & 4 deletions reversion_compare/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,12 @@ def compare_DateTimeField(self, obj_compare):
def compare_BooleanField(self, obj_compare):
''' compare booleans as a complete field, rather than as a string '''
context = {
"bool1": obj_compare.value1,
"bool2": obj_compare.value2,
"bool1": str(obj_compare.value1),
"bool2": str(obj_compare.value2),
}
return render_to_string("reversion-compare/compare_BooleanField.html", context)

x = render_to_string("reversion-compare/compare_BooleanField.html", context)
print x
return x

def compare_NullBooleanField(self, obj_compare):
return self.compare_BooleanField(obj_compare)
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% load i18n %}

<pre class="highlight">
<del>- {{ bool1 }}</del>
<ins>+ {{ bool2 }}</ins>
<del>- {{ bool1 }}</del> {%trans 'changed to' %} <ins>+ {{ bool2 }}</ins>
</pre>
2 changes: 1 addition & 1 deletion reversion_compare/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@ def get_context_data(self, **kwargs):
"comparable": comparable,
"compare_view": True,
})
return context
return context
2 changes: 1 addition & 1 deletion tests/test_utils/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ def create_VariantModel_data(self):

test_data = (
("boolean", True),
("null_boolean", None),
("null_boolean", False),
("null_boolean", None),
("char", "B"),
("text", "Bar 'two'"),
# skip: models.SlugField()
Expand Down
7 changes: 2 additions & 5 deletions tests/test_variant_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,10 @@ def test_all_changes(self):
self.assertContainsHtml(response, *field_headlines)
self.assertContainsHtml(response,
"<h3>boolean</h3>",
"<del>- False</del>",
"<ins>+ True</ins>",
'<pre class="highlight"><del>- False</del> changed to <ins>+ True</ins></pre>',

"<h3>null boolean</h3>",
"<del>- True</del>",
"<ins>+ False</ins>",
'<pre class="highlight"><del>- True</del> changed to <ins>+ None</ins></pre>',

"<h3>char</h3>",
"<del>- a</del>",
Expand Down Expand Up @@ -206,4 +204,3 @@ def test_all_changes(self):
"<del>- 192.168.0.1</del>",
"<ins>+ 10.0.0.0</ins>",
)

0 comments on commit e02f611

Please sign in to comment.