diff options
author | mnandri <mnandri@eumguccion.corporate.thoughtworks.com> | 2015-12-15 18:05:43 +0100 |
---|---|---|
committer | mnandri <mnandri@eunglick.corporate.thoughtworks.com> | 2015-12-18 11:22:34 +0100 |
commit | f8ac23150f5f840eaa4ef920b003966f911de8fa (patch) | |
tree | bf8179d942a0f0e7cc5017a243dded302212b9ed /service/test/unit | |
parent | 93350f99193b78c6adf0b79b8565fe477912fd80 (diff) |
enabling backend for Attachment feature toggle
Issue #548
Diffstat (limited to 'service/test/unit')
-rw-r--r-- | service/test/unit/resources/test_features_resource.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/service/test/unit/resources/test_features_resource.py b/service/test/unit/resources/test_features_resource.py new file mode 100644 index 00000000..bcfad94c --- /dev/null +++ b/service/test/unit/resources/test_features_resource.py @@ -0,0 +1,41 @@ +import json +import os +import unittest + +from mock import patch +from mockito import mock, when, verify +from twisted.internet import defer +from twisted.web.test.requesthelper import DummyRequest + +from pixelated.resources.attachments_resource import AttachmentsResource +from pixelated.resources.features_resource import FeaturesResource +from test.unit.resources import DummySite + + +class FeatureResourceTest(unittest.TestCase): + + def setUp(self): + self.feature_resource = FeaturesResource() + self.web = DummySite(self.feature_resource) + + def test_attachment_feature_is_disabled(self): + request = DummyRequest(['/features']) + + with patch.dict(os.environ, {}, clear=True): + self.web.get(request) + + self.assertEqual(200, request.code) + + response = json.loads(request.written[0]) + self.assertTrue('attachment' in response['disabled_features']) + + def test_attachment_feature_is_enabled(self): + request = DummyRequest(['/features']) + + with patch.dict(os.environ, {'ATTACHMENT': 'Not empty'}, clear=True): + self.web.get(request) + + self.assertEqual(200, request.code) + + response = json.loads(request.written[0]) + self.assertFalse('attachment' in response['disabled_features']) |