Merge lp:~michael.nelson/ubuntu-webcatalog/1015505-extras-not-propietary into lp:ubuntu-webcatalog

Proposed by Michael Nelson
Status: Merged
Approved by: Łukasz Czyżykowski
Approved revision: 156
Merged at revision: 151
Proposed branch: lp:~michael.nelson/ubuntu-webcatalog/1015505-extras-not-propietary
Merge into: lp:ubuntu-webcatalog
Diff against target: 352 lines (+215/-25)
7 files modified
src/webcatalog/migrations/0023_add_license.py (+168/-0)
src/webcatalog/models/applications.py (+4/-4)
src/webcatalog/templates/webcatalog/install_options_snippet.html (+1/-1)
src/webcatalog/tests/factory.py (+2/-2)
src/webcatalog/tests/test_commands.py (+1/-0)
src/webcatalog/tests/test_data/sca_apps.txt (+2/-1)
src/webcatalog/tests/test_views.py (+37/-17)
To merge this branch: bzr merge lp:~michael.nelson/ubuntu-webcatalog/1015505-extras-not-propietary
Reviewer Review Type Date Requested Status
Łukasz Czyżykowski Pending
Review via email: mp+112030@code.launchpad.net

Commit message

Display correct license (from import) on details page.

Description of the change

Overview
========

As per the pre-imp discussion on bug 1015505, this branch adds the Application.license field, and updates the license_type property to be based on that instead of the somewhat confusing Application.for_purchase field.

I also update the template so that it displays a 'buy' button when the price is non-zero, rather than depending on the 'for_purchase' field.

`fab test`

We'll rename for_purchase for bug 1015515 to 'imported_from_sca', as it will need to be used used to determine if the import script should update data.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'src/webcatalog/migrations/0023_add_license.py'
--- src/webcatalog/migrations/0023_add_license.py 1970-01-01 00:00:00 +0000
+++ src/webcatalog/migrations/0023_add_license.py 2012-06-26 09:42:20 +0000
@@ -0,0 +1,168 @@
1# encoding: utf-8
2import datetime
3from south.db import db
4from south.v2 import SchemaMigration
5from django.db import models
6
7class Migration(SchemaMigration):
8
9 def forwards(self, orm):
10
11 # Adding field 'Application.license'
12 db.add_column('webcatalog_application', 'license', self.gf('django.db.models.fields.CharField')(default='', max_length=64, blank=True), keep_default=False)
13
14
15 def backwards(self, orm):
16
17 # Deleting field 'Application.license'
18 db.delete_column('webcatalog_application', 'license')
19
20
21 models = {
22 'auth.group': {
23 'Meta': {'object_name': 'Group'},
24 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
25 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
26 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
27 },
28 'auth.permission': {
29 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
30 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
31 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
32 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
33 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
34 },
35 'auth.user': {
36 'Meta': {'object_name': 'User'},
37 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
38 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
39 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
40 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
41 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
42 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
43 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
44 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
45 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
46 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
47 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
48 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
49 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
50 },
51 'contenttypes.contenttype': {
52 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
53 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
54 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
55 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
56 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
57 },
58 'webcatalog.application': {
59 'Meta': {'ordering': "('-wilson_score', 'name')", 'unique_together': "(('distroseries', 'archive_id'),)", 'object_name': 'Application'},
60 'app_type': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
61 'application_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
62 'architectures': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
63 'archive_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '64', 'null': 'True', 'blank': 'True'}),
64 'categories': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
65 'channel': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
66 'comment': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
67 'debtags': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
68 'departments': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['webcatalog.Department']", 'symmetrical': 'False', 'blank': 'True'}),
69 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
70 'distroseries': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['webcatalog.DistroSeries']"}),
71 'for_purchase': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
72 'icon': ('django.db.models.fields.files.ImageField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
73 'icon_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
74 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
75 'is_latest': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
76 'keywords': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
77 'license': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),
78 'mimetype': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}),
79 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
80 'package_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
81 'popcon': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
82 'price': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '7', 'decimal_places': '2', 'blank': 'True'}),
83 'ratings_average': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '3', 'decimal_places': '2', 'blank': 'True'}),
84 'ratings_histogram': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
85 'ratings_total': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
86 'section': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
87 'version': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),
88 'wilson_score': ('django.db.models.fields.FloatField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'})
89 },
90 'webcatalog.applicationmedia': {
91 'Meta': {'ordering': "('url',)", 'unique_together': "(('application', 'url'),)", 'object_name': 'ApplicationMedia'},
92 'application': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['webcatalog.Application']"}),
93 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
94 'media_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
95 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
96 },
97 'webcatalog.consumer': {
98 'Meta': {'object_name': 'Consumer'},
99 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
100 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
101 'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
102 'secret': ('django.db.models.fields.CharField', [], {'default': "'DpYRwsRbRiwFRbElWgbhSktlpldyjT'", 'max_length': '255', 'blank': 'True'}),
103 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
104 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'oauth_consumer'", 'unique': 'True', 'to': "orm['auth.User']"})
105 },
106 'webcatalog.department': {
107 'Meta': {'object_name': 'Department'},
108 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
109 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
110 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['webcatalog.Department']", 'null': 'True', 'blank': 'True'}),
111 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'})
112 },
113 'webcatalog.distroseries': {
114 'Meta': {'object_name': 'DistroSeries'},
115 'code_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20', 'db_index': 'True'}),
116 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
117 'prerelease': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
118 'version': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'})
119 },
120 'webcatalog.exhibit': {
121 'Meta': {'object_name': 'Exhibit'},
122 'banner_url': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
123 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
124 'display': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
125 'distroseries': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['webcatalog.DistroSeries']", 'symmetrical': 'False'}),
126 'html': ('django.db.models.fields.TextField', [], {}),
127 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
128 'package_names': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
129 'published': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
130 'sca_id': ('django.db.models.fields.IntegerField', [], {}),
131 'weight': ('django.db.models.fields.IntegerField', [], {'default': '0'})
132 },
133 'webcatalog.machine': {
134 'Meta': {'unique_together': "(('owner', 'uuid'),)", 'object_name': 'Machine'},
135 'hostname': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
136 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
137 'logo_checksum': ('django.db.models.fields.CharField', [], {'max_length': '56', 'blank': 'True'}),
138 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
139 'package_list': ('django.db.models.fields.TextField', [], {}),
140 'packages_checksum': ('django.db.models.fields.CharField', [], {'max_length': '56'}),
141 'uuid': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'})
142 },
143 'webcatalog.nonce': {
144 'Meta': {'object_name': 'Nonce'},
145 'consumer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['webcatalog.Consumer']"}),
146 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
147 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
148 'nonce': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
149 'token': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['webcatalog.Token']"})
150 },
151 'webcatalog.reviewstatsimport': {
152 'Meta': {'object_name': 'ReviewStatsImport'},
153 'distroseries': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['webcatalog.DistroSeries']", 'unique': 'True'}),
154 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
155 'last_import': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.utcnow'})
156 },
157 'webcatalog.token': {
158 'Meta': {'object_name': 'Token'},
159 'consumer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['webcatalog.Consumer']"}),
160 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
161 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
162 'token': ('django.db.models.fields.CharField', [], {'default': "'IXcKPvbbhtCyTSqNVxRwfbaHLczIBwpjofnpaaGKLcnQgLWwBL'", 'max_length': '50', 'primary_key': 'True'}),
163 'token_secret': ('django.db.models.fields.CharField', [], {'default': "'eAJdlxCXakKtlHCevxWppBNjLyRSuilBBVbhanfmpXeqhpRBLZ'", 'max_length': '50'}),
164 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
165 }
166 }
167
168 complete_apps = ['webcatalog']
0169
=== modified file 'src/webcatalog/models/applications.py'
--- src/webcatalog/models/applications.py 2012-06-21 11:40:36 +0000
+++ src/webcatalog/models/applications.py 2012-06-26 09:42:20 +0000
@@ -102,6 +102,9 @@
102 is_latest = models.BooleanField()102 is_latest = models.BooleanField()
103 wilson_score = models.FloatField(null=True, blank=True, db_index=True)103 wilson_score = models.FloatField(null=True, blank=True, db_index=True)
104 debtags = models.CharField(max_length=255, blank=True)104 debtags = models.CharField(max_length=255, blank=True)
105 license = models.CharField(
106 max_length=64, blank=True,
107 help_text=u"The name of the license used for the app.")
105108
106 # Other desktop fields used by s-c109 # Other desktop fields used by s-c
107 # x-gnome-fullname110 # x-gnome-fullname
@@ -174,10 +177,7 @@
174 return crumbs177 return crumbs
175178
176 def license_type(self):179 def license_type(self):
177 if self.for_purchase:180 return self.license or "Open Source"
178 return "Proprietary"
179 else:
180 return "Open Source"
181181
182 @property182 @property
183 def architectures_list(self):183 def architectures_list(self):
184184
=== modified file 'src/webcatalog/templates/webcatalog/install_options_snippet.html'
--- src/webcatalog/templates/webcatalog/install_options_snippet.html 2012-03-13 16:25:34 +0000
+++ src/webcatalog/templates/webcatalog/install_options_snippet.html 2012-06-26 09:42:20 +0000
@@ -7,7 +7,7 @@
7{% endif %}7{% endif %}
8{% if display_install_button %}8{% if display_install_button %}
9 <a href="apt://{{ application.package_name }}">9 <a href="apt://{{ application.package_name }}">
10 {% if application.for_purchase %}10 {% if application.price %}
11<img class="fancy-install" width="200" height="60" alt="" src="{{ STATIC_URL }}images/scbutton-non-free-200px.png" title="Buy it from the Ubuntu Software Centre!">11<img class="fancy-install" width="200" height="60" alt="" src="{{ STATIC_URL }}images/scbutton-non-free-200px.png" title="Buy it from the Ubuntu Software Centre!">
12 {% else %}12 {% else %}
13<img class="fancy-install" width="200" height="60" alt="" src="{{ STATIC_URL }}images/scbutton-free-200px.png" title="Get it from the Ubuntu Software Centre!">13<img class="fancy-install" width="200" height="60" alt="" src="{{ STATIC_URL }}images/scbutton-free-200px.png" title="Get it from the Ubuntu Software Centre!">
1414
=== modified file 'src/webcatalog/tests/factory.py'
--- src/webcatalog/tests/factory.py 2012-06-21 11:40:36 +0000
+++ src/webcatalog/tests/factory.py 2012-06-26 09:42:20 +0000
@@ -104,7 +104,7 @@
104 ratings_histogram='', screenshot_url='',104 ratings_histogram='', screenshot_url='',
105 archive_id=None, version='', is_latest=False,105 archive_id=None, version='', is_latest=False,
106 wilson_score=0.0, debtags=[], application_id=None,106 wilson_score=0.0, debtags=[], application_id=None,
107 departments=None):107 departments=None, license='', price=None):
108 if name is None:108 if name is None:
109 name = self.get_unique_string(prefix='Readable Name')109 name = self.get_unique_string(prefix='Readable Name')
110 if package_name is None:110 if package_name is None:
@@ -124,7 +124,7 @@
124 ratings_histogram=ratings_histogram,124 ratings_histogram=ratings_histogram,
125 archive_id=archive_id, version=version, is_latest=is_latest,125 archive_id=archive_id, version=version, is_latest=is_latest,
126 wilson_score=wilson_score, debtags=debtags,126 wilson_score=wilson_score, debtags=debtags,
127 application_id=application_id)127 application_id=application_id, license=license, price=price)
128128
129 if departments is not None:129 if departments is not None:
130 for d in departments:130 for d in departments:
131131
=== modified file 'src/webcatalog/tests/test_commands.py'
--- src/webcatalog/tests/test_commands.py 2012-06-21 20:18:44 +0000
+++ src/webcatalog/tests/test_commands.py 2012-06-26 09:42:20 +0000
@@ -587,6 +587,7 @@
587 distroseries=self.natty)587 distroseries=self.natty)
588 self.assertEqual(True, app_for_purchase.for_purchase)588 self.assertEqual(True, app_for_purchase.for_purchase)
589 self.assertTrue(app_for_purchase.description.find('hello') > -1)589 self.assertTrue(app_for_purchase.description.find('hello') > -1)
590 self.assertEqual("Proprietary", app_for_purchase.license)
590591
591 def test_app_gets_distroseries(self):592 def test_app_gets_distroseries(self):
592 with patch_settings(UBUNTU_SERIES_FOR_VERSIONS=TEST_VERSIONS):593 with patch_settings(UBUNTU_SERIES_FOR_VERSIONS=TEST_VERSIONS):
593594
=== modified file 'src/webcatalog/tests/test_data/sca_apps.txt'
--- src/webcatalog/tests/test_data/sca_apps.txt 2012-05-03 12:13:00 +0000
+++ src/webcatalog/tests/test_data/sca_apps.txt 2012-06-26 09:42:20 +0000
@@ -18,7 +18,8 @@
18 "tos_url": "",18 "tos_url": "",
19 "icon_url": "http://localhost:8000/site_media/icons/2011/06/eg_64x64.png",19 "icon_url": "http://localhost:8000/site_media/icons/2011/06/eg_64x64.png",
20 "categories": "Audio",20 "categories": "Audio",
21 "name": "MyApp"21 "name": "MyApp",
22 "license": "Proprietary"
22 },23 },
23 {24 {
24 "package_name": "eg_arb_app",25 "package_name": "eg_arb_app",
2526
=== modified file 'src/webcatalog/tests/test_views.py'
--- src/webcatalog/tests/test_views.py 2012-06-21 11:44:00 +0000
+++ src/webcatalog/tests/test_views.py 2012-06-26 09:42:20 +0000
@@ -76,6 +76,18 @@
76 return reverse('wc-package-detail',76 return reverse('wc-package-detail',
77 args=[app.distroseries.code_name, app.package_name])77 args=[app.distroseries.code_name, app.package_name])
7878
79 def get_package_details_response(self, package_name,
80 useragent=UBUNTU_USERAGENT, distro=None):
81 kwargs = dict(package_name=package_name)
82 if distro:
83 kwargs['distro'] = distro
84 url = reverse('wc-package-detail', kwargs=kwargs)
85
86 if useragent:
87 return self.client.get(url, HTTP_USER_AGENT=useragent)
88 else:
89 return self.client.get(url)
90
79 def get_app_and_response(self, code_name='natty', version='11.04',91 def get_app_and_response(self, code_name='natty', version='11.04',
80 arch='x86_64', name=None, comment=None,92 arch='x86_64', name=None, comment=None,
81 description=None, detail_distro=None,93 description=None, detail_distro=None,
@@ -96,13 +108,8 @@
96 if not detail_package:108 if not detail_package:
97 detail_package = app.package_name109 detail_package = app.package_name
98110
99 url = reverse('wc-package-detail',111 response = self.get_package_details_response(
100 args=[detail_distro, detail_package])112 detail_package, distro=detail_distro, useragent=useragent)
101
102 if useragent:
103 response = self.client.get(url, HTTP_USER_AGENT=useragent)
104 else:
105 response = self.client.get(url)
106 return response, app113 return response, app
107114
108 def test_renders_correct_template(self):115 def test_renders_correct_template(self):
@@ -160,14 +167,20 @@
160 self.assertNotContains(response, '<div class="recommendations">')167 self.assertNotContains(response, '<div class="recommendations">')
161168
162 def test_button_for_non_puchase_app(self):169 def test_button_for_non_puchase_app(self):
163 response, app = self.get_app_and_response()170 self.factory.make_application(package_name='pkgfoo',
171 price=None)
172
173 response = self.get_package_details_response('pkgfoo')
164174
165 self.assertContains(response, '/assets/images/scbutton-free-200px.png')175 self.assertContains(response, '/assets/images/scbutton-free-200px.png')
166 self.assertNotContains(response,176 self.assertNotContains(response,
167 '/assets/images/scbutton-non-free-200px.png')177 '/assets/images/scbutton-non-free-200px.png')
168178
169 def test_button_for_for_puchase_app(self):179 def test_button_for_for_puchase_app(self):
170 response, app = self.get_app_and_response(for_purchase=True)180 self.factory.make_application(package_name='pkgfoo',
181 price=Decimal('12.99'))
182
183 response = self.get_package_details_response('pkgfoo')
171184
172 self.assertNotContains(response,185 self.assertNotContains(response,
173 '/assets/images/scbutton-free-200px.png')186 '/assets/images/scbutton-free-200px.png')
@@ -284,15 +297,22 @@
284 self.assertContains(response, "Ubuntu Quantal")297 self.assertContains(response, "Ubuntu Quantal")
285298
286 def test_includes_right_license_type(self):299 def test_includes_right_license_type(self):
287 response, app = self.get_app_and_response(for_purchase=False)300 self.factory.make_application(license="Foo GNL V1",
301 package_name='pkgfoo')
302
303 response = self.client.get(
304 reverse('wc-package-detail', args=['pkgfoo']))
305
306 self.assertContains(response, '<td>Foo GNL V1</td>')
307
308 def test_no_license_assumes_OSS(self):
309 self.factory.make_application(license="",
310 package_name='pkgfoo')
311
312 response = self.client.get(
313 reverse('wc-package-detail', args=['pkgfoo']))
314
288 self.assertContains(response, '<td>Open Source</td>')315 self.assertContains(response, '<td>Open Source</td>')
289 self.assertNotContains(response, '<td>Proprietary</td>')
290
291 app.for_purchase = True
292 app.save()
293 response = self.client.get(self.get_app_details_url(app))
294 self.assertContains(response, '<td>Proprietary</td>')
295 self.assertNotContains(response, '<td>Open Source</td>')
296316
297 def test_response_includes_rating_summary(self):317 def test_response_includes_rating_summary(self):
298 distro = self.factory.make_distroseries(code_name='lucid')318 distro = self.factory.make_distroseries(code_name='lucid')

Subscribers

People subscribed via source and target branches