Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
devketanpro committed Oct 31, 2023
1 parent e363495 commit c0c7c9e
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion apps/publish/publish_service_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,29 @@ class PublishServiceTests(TestCase):
"sequence_num_settings": {"max": 10, "min": 1},
"critical_errors": {"9004": True},
"destinations": [{"name": "NITF", "delivery_type": "ftp", "format": "nitf", "config": {}}],
}
},
{
"_id": "2",
"name": "Test2",
"subscriber_type": SUBSCRIBER_TYPES.WIRE,
"media_type": "media",
"is_active": True,
"sequence_num_settings": {"max": 10, "min": 1},
"critical_errors": {"9004": True},
"destinations": [
{
"name": "HTTP PUSH",
"delivery_type": "http_push",
"format": "nitf",
"config": {
"resource_url": "http://localhost:5050/push",
"assets_url": "http://localhost:5050/push_binary",
"packaged": "true",
"secret_token": "newsroom",
},
}
],
},
]

def setUp(self):
Expand Down Expand Up @@ -114,3 +136,10 @@ def test_highlight_query(self):
self.assertEqual(
["body_html", "body_footer", "headline", "slugline", "abstract"], list(source["highlight"]["fields"].keys())
)

def test_subscribers_secret_token(self):
subscriber_service = superdesk.get_resource_service("subscribers")
data = list(subscriber_service.get(req=None, lookup={}))
item = data[1]
self.assertEqual("Test2", item["name"])
self.assertNotIn("secret_token", item["destinations"][0]["config"])

0 comments on commit c0c7c9e

Please sign in to comment.