Skip to content

Commit

Permalink
Merge branch 'openwisp:master' into issues/140-FileNotFound-exception
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhigyaShridhar authored Apr 13, 2022
2 parents ba7ac15 + 17fe448 commit c19f1cd
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 30 deletions.
48 changes: 24 additions & 24 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ the results in conjunction with the ``page`` parameter.

.. code-block:: text
GET /api/v1/firmware/build/?page_size=10
GET /api/v1/firmware/build/?page_size=10&page=2
GET /api/v1/firmware-upgrader/build/?page_size=10
GET /api/v1/firmware-upgrader/build/?page_size=10&page=2
Filtering by organization slug
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -492,7 +492,7 @@ Most endpoints allow to filter by organization slug, eg:

.. code-block:: text
GET /api/v1/firmware/build/?organization=org-slug
GET /api/v1/firmware-upgrader/build/?organization=org-slug
List of endpoints
~~~~~~~~~~~~~~~~~
Expand All @@ -507,91 +507,91 @@ List mass upgrade operations

.. code-block:: text
GET /api/v1/firmware/batch-upgrade-operation/
GET /api/v1/firmware-upgrader/batch-upgrade-operation/
Get mass upgrade operation detail
#################################

.. code-block:: text
GET /api/v1/firmware/batch-upgrade-operation/{id}/
GET /api/v1/firmware-upgrader/batch-upgrade-operation/{id}/
List firmware builds
####################

.. code-block:: text
GET /api/v1/firmware/build/
GET /api/v1/firmware-upgrader/build/
Create firmware build
#####################

.. code-block:: text
POST /api/v1/firmware/build/
POST /api/v1/firmware-upgrader/build/
Get firmware build details
##########################

.. code-block:: text
GET /api/v1/firmware/build/{id}/
GET /api/v1/firmware-upgrader/build/{id}/
Change details of firmware build
################################

.. code-block:: text
PUT /api/v1/firmware/build/{id}/
PUT /api/v1/firmware-upgrader/build/{id}/
Patch details of firmware build
###############################

.. code-block:: text
PATCH /api/v1/firmware/build/{id}/
PATCH /api/v1/firmware-upgrader/build/{id}/
Delete firmware build
#####################

.. code-block:: text
DELETE /api/v1/firmware/build/{id}/
DELETE /api/v1/firmware-upgrader/build/{id}/
Get list of images of a firmware build
######################################

.. code-block:: text
GET /api/v1/firmware/build/{id}/image/
GET /api/v1/firmware-upgrader/build/{id}/image/
Upload new firmware image to the build
######################################

.. code-block:: text
POST /api/v1/firmware/build/{id}/image/
POST /api/v1/firmware-upgrader/build/{id}/image/
Get firmware image details
##########################

.. code-block:: text
GET /api/v1/firmware/build/{build_pk}/image/{id}/
GET /api/v1/firmware-upgrader/build/{build_pk}/image/{id}/
Delete firmware image
#####################

.. code-block:: text
DELETE /api/v1/firmware/build/{build_pk}/image/{id}/
DELETE /api/v1/firmware-upgrader/build/{build_pk}/image/{id}/
Download firmware image
#######################

.. code-block:: text
GET /api/v1/firmware/build/{build_pk}/image/{id}/download/
GET /api/v1/firmware-upgrader/build/{build_pk}/image/{id}/download/
Perform batch upgrade
#####################
Expand All @@ -600,7 +600,7 @@ Upgrades all the devices related to the specified build ID.

.. code-block:: text
POST /api/v1/firmware/build/{id}/upgrade/
POST /api/v1/firmware-upgrader/build/{id}/upgrade/
Dry-run batch upgrade
#####################
Expand All @@ -613,49 +613,49 @@ object exists for a device which would be upgraded.

.. code-block:: text
GET /api/v1/firmware/build/{id}/upgrade/
GET /api/v1/firmware-upgrader/build/{id}/upgrade/
List firmware categories
########################

.. code-block:: text
GET /api/v1/firmware/category/
GET /api/v1/firmware-upgrader/category/
Create new firmware category
############################

.. code-block:: text
POST /api/v1/firmware/category/
POST /api/v1/firmware-upgrader/category/
Get firmware category details
#############################

.. code-block:: text
GET /api/v1/firmware/category/{id}/
GET /api/v1/firmware-upgrader/category/{id}/
Change the details of a firmware category
#########################################

.. code-block:: text
PUT /api/v1/firmware/category/{id}/
PUT /api/v1/firmware-upgrader/category/{id}/
Patch the details of a firmware category
########################################

.. code-block:: text
PATCH /api/v1/firmware/category/{id}/
PATCH /api/v1/firmware-upgrader/category/{id}/
Delete a firmware category
##########################

.. code-block:: text
DELETE /api/v1/firmware/category/{id}/
DELETE /api/v1/firmware-upgrader/category/{id}/
Installing for development
--------------------------
Expand Down
2 changes: 1 addition & 1 deletion openwisp_firmware_upgrader/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

urlpatterns = [
path(
'firmware/',
'firmware-upgrader/',
include(
[
path('build/', views.build_list, name='api_build_list'),
Expand Down
14 changes: 14 additions & 0 deletions openwisp_firmware_upgrader/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,20 @@
'boards': ('TP-LINK CPE510 v3',),
},
),
(
'ar71xx-generic-tl-wdr3600-v1-squashfs-sysupgrade.bin',
{
'label': 'TP-Link WDR3600 v1 (OpenWRT 19.07 and earlier)',
'boards': ('TP-Link TL-WDR3600 v1',),
},
),
(
'ath79-generic-tplink_tl-wdr3600-v1-squashfs-sysupgrade.bin',
{
'label': 'TP-Link WDR3600 v1 (OpenWRT 19.07 and later)',
'boards': ('TP-Link TL-WDR3600 v1',),
},
),
(
'ar71xx-generic-tl-wdr4300-v1-squashfs-sysupgrade.bin',
{
Expand Down
13 changes: 8 additions & 5 deletions openwisp_firmware_upgrader/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,11 @@ def test_category_unauthorized(self):
org2 = self._create_org(name='org2', slug='org2')
self.tearDown()
self.operator.openwisp_users_organization.all().delete()
OrganizationUser.objects.create(user=self.administrator, organization=org2)

OrganizationUser.objects.create(
user=self.administrator, organization=org2, is_admin=True
)
url = reverse('upgrader:api_category_detail', args=[category.pk])
with self.assertNumQueries(3):
with self.assertNumQueries(4):
r = self.client.get(url)
self.assertEqual(r.status_code, 404)

Expand Down Expand Up @@ -462,12 +463,14 @@ def test_batchupgradeoperation_unauthorized(self):
org2 = self._create_org(name='org2', slug='org2')
self.tearDown()
self.administrator.openwisp_users_organization.all().delete()
OrganizationUser.objects.create(user=self.administrator, organization=org2)
OrganizationUser.objects.create(
user=self.administrator, organization=org2, is_admin=True
)

url = reverse(
'upgrader:api_batchupgradeoperation_detail', args=[env['build2'].pk]
)
with self.assertNumQueries(3):
with self.assertNumQueries(4):
r = self.client.get(url)
self.assertEqual(r.status_code, 404)

Expand Down

0 comments on commit c19f1cd

Please sign in to comment.