def teste_should_get_list_of_apps_from_tsuru(self, get): expected = [{"framework": "python", "name": "pacote", "repository": "[email protected]:pacote.git", "state": "creating"}] response_mock = Mock(status_code=200) response_mock.json.return_value = expected get.return_value = response_mock response = ListAppAdmin.as_view()(self.request) self.assertListEqual([{"framework": "python", "name": "pacote", "repository": "[email protected]:pacote.git", "state": "creating"}], response.context_data["apps"])
def teste_should_get_list_of_apps_from_tsuru(self, get): expected = [{ "framework": "python", "name": "pacote", "repository": "[email protected]:pacote.git", "state": "creating" }] response_mock = Mock(status_code=200) response_mock.json.return_value = expected get.return_value = response_mock response = ListAppAdmin.as_view()(self.request) self.assertListEqual([{ "framework": "python", "name": "pacote", "repository": "[email protected]:pacote.git", "state": "creating" }], response.context_data["apps"])
def test_should_use_list_template(self, get): get.return_value = Mock(status_code=204) response = ListAppAdmin.as_view()(self.request) self.assertEqual("apps/list_app_admin.html", response.template_name) self.assertListEqual([], response.context_data['apps'])