def test_should_use_create_template(self, get): content = u"""[{"Name":"python"},{"Name":"ruby"},{"Name":"static"}]""" m = Mock(status_code=200, content=content) m.json.return_value = json.loads(content) get.return_value = m request = RequestFactory().get("/") request.session = {} view = CreateApp() view.plans = lambda r: ("small", [("small", "small")]) view.teams = lambda r: [] view.pools = lambda r: [] response = view.get(request) self.assertEqual("apps/create.html", response.template_name)
def test_AppForm_should_be_in_context(self, get): content = u"""[{"Name":"python"},{"Name":"ruby"},{"Name":"static"}]""" m = Mock(status_code=200, content=content) m.json.return_value = json.loads(content) get.return_value = m request = RequestFactory().get("/") request.session = {} view = CreateApp() view.plans = lambda r: ("basic", [("basic", "basic")]) view.teams = lambda r: [] view.pools = lambda r: [] response = view.get(request) app_form = response.context_data['app_form'] self.assertIsInstance(app_form, forms.AppForm)