remove the install abomination (bug 858398)
This commit is contained in:
Родитель
60896ce35b
Коммит
ef8d3f2e10
|
@ -61,9 +61,6 @@ Account
|
|||
{
|
||||
"resource_uri": "/api/v1/account/settings/1/",
|
||||
"display_name": "Nice person",
|
||||
"installed": [
|
||||
"/api/v1/apps/3/"
|
||||
]
|
||||
}
|
||||
|
||||
The same information is also accessible at the canoncial `resource_uri`
|
||||
|
@ -88,10 +85,6 @@ Fields that can be updated:
|
|||
|
||||
* *display_name*
|
||||
|
||||
Fields that are read only:
|
||||
|
||||
* *installed*
|
||||
|
||||
Categories
|
||||
==========
|
||||
|
||||
|
@ -203,7 +196,7 @@ Report An Abusive App
|
|||
}
|
||||
|
||||
This endpoint uses `PotatoCaptcha`, so there must be a field named `sprout`
|
||||
with the value `potato` and cannot be a field named `tuber` with a truthy
|
||||
with the value `potato` and cannot be a field named `tuber` with a truthy
|
||||
value.
|
||||
|
||||
**Response**
|
||||
|
@ -243,10 +236,10 @@ Report An Abusive User
|
|||
"sprout": "potato",
|
||||
"text": "There is a problem with this user",
|
||||
"user": 27
|
||||
}
|
||||
}
|
||||
|
||||
This endpoint uses `PotatoCaptcha`, so there must be a field named `sprout`
|
||||
with the value `potato` and cannot be a field named `tuber` with a truthy
|
||||
with the value `potato` and cannot be a field named `tuber` with a truthy
|
||||
value.
|
||||
|
||||
**Response**
|
||||
|
|
|
@ -10,7 +10,6 @@ from tastypie.authorization import Authorization
|
|||
from tastypie.exceptions import ImmediateHttpResponse
|
||||
from tastypie.throttle import CacheThrottle
|
||||
|
||||
from amo.urlresolvers import reverse
|
||||
from amo.utils import send_mail_jinja
|
||||
from mkt.api.authentication import (OAuthAuthentication,
|
||||
OptionalOAuthAuthentication,
|
||||
|
@ -19,7 +18,6 @@ from mkt.api.authentication import (OAuthAuthentication,
|
|||
from mkt.api.base import (CORSResource, GenericObject,
|
||||
MarketplaceModelResource, MarketplaceResource,
|
||||
PotatoCaptchaResource)
|
||||
from mkt.constants.apps import INSTALL_TYPE_USER
|
||||
from users.models import UserProfile
|
||||
from users.views import browserid_login
|
||||
|
||||
|
@ -27,7 +25,6 @@ from .forms import FeedbackForm
|
|||
|
||||
|
||||
class AccountResource(CORSResource, MarketplaceModelResource):
|
||||
installed = fields.ListField('installed_list', readonly=True, null=True)
|
||||
|
||||
class Meta:
|
||||
authentication = (SharedSecretAuthentication(), OAuthAuthentication())
|
||||
|
@ -48,19 +45,6 @@ class AccountResource(CORSResource, MarketplaceModelResource):
|
|||
raise ImmediateHttpResponse(response=http.HttpForbidden())
|
||||
return obj
|
||||
|
||||
def dehydrate_installed(self, bundle):
|
||||
# A list of the installed addons (rather than the installed_set table)
|
||||
#
|
||||
# Warning doing it this way, won't give us pagination. So less keen on
|
||||
# this, perhaps we should cap this number?
|
||||
res = (bundle.obj.installed_set.filter(install_type=INSTALL_TYPE_USER)
|
||||
.values_list('addon_id', flat=True))
|
||||
res = [reverse('api_dispatch_detail',
|
||||
kwargs={'pk': r, 'api_name': 'apps',
|
||||
'resource_name': 'app'})
|
||||
for r in res]
|
||||
return res
|
||||
|
||||
|
||||
class LoginResource(CORSResource, MarketplaceResource):
|
||||
|
||||
|
|
|
@ -48,23 +48,6 @@ class TestAccount(BaseOAuth):
|
|||
eq_(res.status_code, 200, res.content)
|
||||
data = json.loads(res.content)
|
||||
eq_(data['display_name'], self.user.display_name)
|
||||
eq_(data['installed'], [])
|
||||
|
||||
def test_install(self):
|
||||
ins = Installed.objects.create(user=self.user, addon_id=337141)
|
||||
res = self.client.get(self.get_url)
|
||||
eq_(res.status_code, 200, res.content)
|
||||
data = json.loads(res.content)
|
||||
eq_(data['installed'],
|
||||
[get_absolute_url(get_url('app', ins.addon.pk), absolute=False)])
|
||||
|
||||
def test_install_reviewer(self):
|
||||
Installed.objects.create(user=self.user, addon_id=337141,
|
||||
install_type=INSTALL_TYPE_REVIEWER)
|
||||
res = self.client.get(self.get_url)
|
||||
eq_(res.status_code, 200, res.content)
|
||||
data = json.loads(res.content)
|
||||
eq_(data['installed'], [])
|
||||
|
||||
def test_other(self):
|
||||
eq_(self.client.get(get_url('settings', '10482')).status_code, 403)
|
||||
|
|
Загрузка…
Ссылка в новой задаче