Changeset 469 in main


Ignore:
Timestamp:
11/10/11 16:13:10 (8 years ago)
Author:
pcosquer
Message:

tests: refactor tests/views.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/plmapp/tests/views.py

    r468 r469  
    6161        brian.get_profile().save() 
    6262        self.brian = brian 
    63      
     63 
    6464    def tearDown(self): 
    6565        if os.path.exists(settings.HAYSTACK_XAPIAN_PATH): 
     
    6868        super(CommonViewTest, self).tearDown() 
    6969 
     70    def post(self, url, data=None, follow=True, status_code=200, 
     71            link=False, page=""): 
     72        return self.get_or_post(self.client.post, url, data, follow, status_code, 
     73                link, page) 
     74 
     75    def get(self, url, data=None, follow=True, status_code=200, 
     76            link=False, page=""): 
     77        return self.get_or_post(self.client.get, url, data, follow, status_code, 
     78                link, page) 
     79     
     80    def get_or_post(self, func, url, data=None, follow=True, status_code=200, 
     81            link=False, page=""): 
     82        response = func(url, data or {}, follow=follow) 
     83        self.assertEqual(response.status_code, status_code) 
     84        self.assertEqual(link, response.context["link_creation"]) 
     85        if page: 
     86            self.assertEqual(page, response.context["current_page"]) 
     87        return response 
     88 
     89 
    7090class ViewTest(CommonViewTest): 
    7191 
    7292    def test_home(self): 
    73         response = self.client.get("/home/", follow=True) 
    74         self.assertEqual(response.status_code, 200) 
     93        response = self.get("/home/") 
    7594         
    7695    def test_create_get(self): 
    77         response = self.client.get("/object/create/", {"type" : self.TYPE}) 
    78         self.assertEqual(response.status_code, 200) 
     96        response = self.get("/object/create/", {"type" : self.TYPE}) 
    7997        self.assertEqual(response.context["object_type"], self.TYPE) 
    8098        self.failUnless(response.context["creation_form"]) 
     
    92110                }) 
    93111 
    94         response = self.client.post("/object/create/", data, follow=True) 
    95         self.assertEqual(response.status_code, 200) 
    96         self.assertEqual("attributes", response.context["current_page"]) 
     112        response = self.post("/object/create/", data, page="attributes") 
    97113        obj = PLMObject.objects.get(type=self.TYPE, reference="mapart", revision="a") 
    98114        self.assertEqual(obj.id, response.context["obj"].id) 
     
    102118 
    103119    def test_display_attributes(self): 
    104         response = self.client.get(self.base_url + "attributes/") 
    105         self.assertEqual(response.status_code,  200) 
     120        response = self.get(self.base_url + "attributes/", page="attributes") 
    106121        self.failUnless(response.context["object_attributes"]) 
    107122        attributes = dict((x.capitalize(), y) for (x,y) in  
     
    116131        data = self.DATA.copy() 
    117132        data.update(type=self.TYPE, name="new_name") 
    118         response = self.client.post(self.base_url + "modify/", data, follow=True) 
    119         self.assertEqual(response.status_code,  200) 
     133        response = self.post(self.base_url + "modify/", data) 
    120134        obj = get_all_plmobjects()[self.TYPE].objects.all()[0] 
    121135        self.assertEqual(obj.name, data["name"]) 
    122136 
    123137    def test_lifecycle(self): 
    124         response = self.client.get(self.base_url + "lifecycle/") 
    125         self.assertEqual(response.status_code, 200) 
     138        response = self.get(self.base_url + "lifecycle/") 
    126139        lifecycles = tuple(response.context["object_lifecycle"]) 
    127140        wanted = (("draft", True), ("official", False), ("deprecated", False)) 
    128141        self.assertEqual(lifecycles, wanted) 
    129142        # promote 
    130         response = self.client.post(self.base_url + "lifecycle/",  
    131                                     {"action" : "PROMOTE"}) 
    132         self.assertEqual(response.status_code, 200) 
     143        response = self.post(self.base_url + "lifecycle/",  
     144                            {"action" : "PROMOTE"}) 
    133145        lifecycles = tuple(response.context["object_lifecycle"]) 
    134146        wanted = (("draft", False), ("official", True), ("deprecated", False)) 
     
    143155        self.controller.promote() 
    144156        self.assertEqual(self.controller.state.name, "issue1") 
    145         response = self.client.post(self.base_url + "lifecycle/",  
     157        response = self.post(self.base_url + "lifecycle/",  
    146158                                    {"action" : "DEMOTE"}) 
    147         self.assertEqual(response.status_code, 200) 
    148159        lifecycles = tuple(response.context["object_lifecycle"]) 
    149160        wanted = (("draft", True), ("issue1", False), ("official", False), 
     
    152163 
    153164    def test_revisions(self): 
    154         response = self.client.get(self.base_url + "revisions/") 
    155         self.assertEqual(response.status_code, 200) 
     165        response = self.get(self.base_url + "revisions/") 
    156166        revisions = response.context["revisions"] 
    157167        self.assertEqual(revisions, [self.controller.object]) 
     
    159169        add_revision_form = response.context["add_revision_form"] 
    160170        self.assertEqual(add_revision_form.data, {"revision": "b"}) 
    161         response = self.client.post(self.base_url + "revisions/", {"revision" :"b"}) 
    162         self.assertEqual(response.status_code, 200) 
     171        response = self.post(self.base_url + "revisions/", {"revision" :"b"}) 
    163172        get_all_plmobjects()[self.TYPE].objects.get(reference=self.controller.reference, 
    164173                revision="b") 
    165174     
    166175    def test_history(self): 
    167         response = self.client.get(self.base_url + "history/") 
    168         self.assertEqual(response.status_code,  200) 
     176        response = self.get(self.base_url + "history/") 
    169177 
    170178    def test_navigate_get(self): 
    171         response = self.client.get(self.base_url + "navigate/") 
    172         self.assertEqual(response.status_code,  200) 
     179        response = self.get(self.base_url + "navigate/") 
    173180        self.assertTrue(response.context["filter_object_form"]) 
    174181        self.assertTrue(response.context["navigate_bool"]) 
     
    179186            "ownede", "to_sign", "request_notification_from"), True) 
    180187        data["prog"] = "neato" 
    181         response = self.client.post(self.base_url + "navigate/", data) 
    182         self.assertEqual(response.status_code,  200) 
     188        response = self.post(self.base_url + "navigate/", data) 
    183189        self.assertTrue(response.context["filter_object_form"]) 
    184190        
    185191    def test_management(self): 
    186         response = self.client.get(self.base_url + "management/") 
    187         self.assertEqual(response.status_code,  200) 
    188         self.assertEqual("management", response.context["current_page"]) 
    189  
     192        response = self.get(self.base_url + "management/", page="management") 
    190193        self.controller.set_owner(self.brian) 
    191         response = self.client.get(self.base_url + "management/") 
     194        response = self.get(self.base_url + "management/") 
    192195        self.assertFalse(response.context["is_notified"]) 
    193196        form = response.context["notify_self_form"] 
     
    196199 
    197200    def test_management_add_get(self): 
    198         response = self.client.get(self.base_url + "management/add/") 
    199         self.assertEqual(response.status_code,  200) 
    200         self.assertEqual("management", response.context["current_page"]) 
    201         self.assertTrue(response.context["link_creation"]) 
     201        response = self.get(self.base_url + "management/add/", 
     202               link=True, page="management") 
    202203        attach = response.context["attach"] 
    203204        self.assertEqual(self.controller.id, attach[0].id) 
     
    206207    def test_management_add_post(self): 
    207208        data = dict(type="User", username=self.brian.username) 
    208         response = self.client.post(self.base_url + "management/add/", 
    209                 data, follow=True) 
    210         self.assertEqual(response.status_code,  200) 
     209        response = self.post(self.base_url + "management/add/", data) 
    211210        self.assertTrue(PLMObjectUserLink.objects.filter(plmobject=self.controller.object, 
    212211            user=self.brian, role=ROLE_NOTIFIED)) 
     
    217216        link = PLMObjectUserLink.objects.get(plmobject=self.controller.object, 
    218217            user=self.brian, role=role) 
    219         response = self.client.get(self.base_url + "management/replace/%d/" % link.id) 
    220         self.assertEqual(response.status_code,  200) 
    221         self.assertEqual("management", response.context["current_page"]) 
    222         self.assertTrue(response.context["link_creation"]) 
     218        response = self.get(self.base_url + "management/replace/%d/" % link.id, 
     219                link=True, page="management") 
    223220        attach = response.context["attach"] 
    224221        self.assertEqual(self.controller.id, attach[0].id) 
     
    231228            user=self.brian, role=role) 
    232229        data = dict(type="User", username=self.user.username) 
    233         response = self.client.post(self.base_url + "management/replace/%d/" % link.id, 
    234                 data, follow=True) 
    235         self.assertEqual(response.status_code,  200) 
     230        response = self.post(self.base_url + "management/replace/%d/" % link.id, 
     231                        data) 
    236232        self.assertFalse(PLMObjectUserLink.objects.filter(plmobject=self.controller.object, 
    237233            user=self.brian, role=role)) 
     
    244240            user=self.brian, role=ROLE_NOTIFIED) 
    245241        data = {"link_id" : link.id } 
    246         response = self.client.post(self.base_url + "management/delete/", 
    247                 data, follow=True) 
    248         self.assertEqual(response.status_code,  200) 
     242        response = self.post(self.base_url + "management/delete/", data) 
    249243        self.assertFalse(PLMObjectUserLink.objects.filter(plmobject=self.controller.object, 
    250244            user=self.brian, role=ROLE_NOTIFIED)) 
     
    260254        self.controller.attach_to_part(part) 
    261255         
    262         response = self.client.get(self.base_url + "parts/") 
    263         self.assertEqual(response.status_code,  200) 
    264         self.assertEqual("parts", response.context["current_page"]) 
     256        response = self.get(self.base_url + "parts/", page="parts") 
    265257        self.assertEqual([part.id], 
    266258                         [p.part.id for p in response.context["object_rel_part"]]) 
    267259         
    268260    def test_add_related_part_get(self): 
    269         response = self.client.get(self.base_url + "parts/add/") 
    270         self.assertEqual(response.status_code,  200) 
    271         self.assertTrue(response.context["link_creation"]) 
     261        response = self.get(self.base_url + "parts/add/", link=True) 
    272262        self.assertTrue(isinstance(response.context["add_rel_part_form"], 
    273263                                   forms.AddRelPartForm)) 
     
    283273                "revision" : part.revision 
    284274                } 
    285         response = self.client.post(self.base_url + "parts/add/", data, follow=True) 
    286         self.assertEqual(response.status_code,  200) 
     275        response = self.post(self.base_url + "parts/add/", data) 
    287276        self.assertEqual([part.id], 
    288277                         [p.part.id for p in self.controller.get_attached_parts()]) 
    289278 
    290279    def test_files_empty_get(self): 
    291         response = self.client.get(self.base_url + "files/") 
    292         self.assertEqual(response.status_code,  200) 
    293         self.assertEqual("files", response.context["current_page"]) 
     280        response = self.get(self.base_url + "files/", page="files") 
    294281        formset = response.context["file_formset"] 
    295282        self.assertEqual(0, formset.total_form_count()) 
     
    297284    def test_files_get(self): 
    298285        self.controller.add_file(self.get_file()) 
    299         response = self.client.get(self.base_url + "files/") 
    300         self.assertEqual(response.status_code,  200) 
    301         self.assertEqual("files", response.context["current_page"]) 
     286        response = self.get(self.base_url + "files/", page="files") 
    302287        formset = response.context["file_formset"] 
    303288        self.assertEqual(1, formset.total_form_count()) 
     
    318303                'form-INITIAL_FORMS': 2, 
    319304                } 
    320         response = self.client.post(self.base_url + "files/", data, follow=True) 
    321         self.assertEqual(response.status_code,  200) 
     305        response = self.post(self.base_url + "files/", data) 
    322306        self.assertEqual([df2.id], [df.id for df in self.controller.files]) 
    323307 
    324308    def test_add_file_get(self): 
    325         response = self.client.get(self.base_url + "files/add/") 
    326         self.assertEqual(response.status_code,  200) 
     309        response = self.get(self.base_url + "files/add/") 
    327310        self.assertTrue(isinstance(response.context["add_file_form"], 
    328311                                   forms.AddFileForm)) 
     
    331314        f = self.get_file(data="crumble") 
    332315        data = { "filename" : f } 
    333         response = self.client.post(self.base_url + "files/add/", data, follow=True) 
    334         self.assertEqual(response.status_code,  200) 
     316        response = self.post(self.base_url + "files/add/", data) 
    335317        df = self.controller.files[0] 
    336318        self.assertEqual(df.filename, f.name) 
     
    341323        super(DocumentViewTestCase, self).test_lifecycle() 
    342324 
    343 class PartViewTestCase(CommonViewTest): 
     325class PartViewTestCase(ViewTest): 
    344326 
    345327    def test_children(self): 
     
    348330        child2 = PartController.create("c2", "Part", "a", self.user, self.DATA) 
    349331        self.controller.add_child(child2, 10, 20) 
    350         response = self.client.get(self.base_url + "BOM-child/") 
    351         self.assertEqual(response.status_code, 200) 
     332        response = self.get(self.base_url + "BOM-child/", page="BOM-child") 
    352333        self.assertEqual(2, len(list(response.context["children"]))) 
    353         self.assertEqual("BOM-child", response.context["current_page"]) 
    354334        form = response.context["display_form"] 
    355335 
    356336    def test_add_child(self): 
    357         response = self.client.get(self.base_url + "BOM-child/add/") 
    358         self.assertEqual(response.status_code, 200) 
    359         self.assertTrue(response.context["link_creation"]) 
     337        response = self.get(self.base_url + "BOM-child/add/", link=True) 
    360338        child1 = PartController.create("c1", "Part", "a", self.user, self.DATA) 
    361339        response = self.client.post(self.base_url + "BOM-child/add/", 
     
    367345        child1 = PartController.create("c1", "Part", "a", self.user, self.DATA) 
    368346        self.controller.add_child(child1, 10 , 20) 
    369         response = self.client.get(self.base_url + "BOM-child/edit/") 
    370         self.assertEqual(response.status_code, 200) 
     347        response = self.get(self.base_url + "BOM-child/edit/") 
    371348        formset = response.context["children_formset"] 
    372349        data = { 
     
    380357            'form-0-quantity' :  '45.0', 
    381358        } 
    382         response = self.client.post(self.base_url + "BOM-child/edit/", data) 
     359        response = self.post(self.base_url + "BOM-child/edit/", data) 
    383360        link = self.controller.get_children()[0].link 
    384361        self.assertEquals(45, link.order) 
     
    386363 
    387364    def test_parents_empty(self): 
    388         response = self.client.get(self.base_url + "parents/") 
    389         self.assertEqual(response.status_code, 200) 
     365        response = self.get(self.base_url + "parents/", page="parents") 
    390366        self.assertEqual(0, len(list(response.context["parents"]))) 
    391         self.assertEqual("parents", response.context["current_page"]) 
    392367         
    393368    def test_parents(self): 
     
    396371        p2 = PartController.create("c2", "Part", "a", self.user, self.DATA) 
    397372        p2.add_child(self.controller, 10, 20) 
    398         response = self.client.get(self.base_url + "parents/") 
    399         self.assertEqual(response.status_code, 200) 
     373        response = self.get(self.base_url + "parents/", page="parents") 
    400374        self.assertEqual(2, len(list(response.context["parents"]))) 
    401         self.assertEqual("parents", response.context["current_page"]) 
    402375 
    403376    def test_doc_cad_empty(self): 
    404         response = self.client.get(self.base_url + "doc-cad/") 
    405         self.assertEqual(response.status_code, 200) 
     377        response = self.get(self.base_url + "doc-cad/", page="doc-cad") 
    406378        self.assertEqual(0, len(list(response.context["object_doc_cad"]))) 
    407         self.assertEqual("doc-cad", response.context["current_page"]) 
    408379     
    409380    def test_doc_cad(self): 
     
    414385        self.controller.attach_to_document(doc1) 
    415386        self.controller.attach_to_document(doc2) 
    416         response = self.client.get(self.base_url + "doc-cad/") 
    417         self.assertEqual(response.status_code, 200) 
     387        response = self.get(self.base_url + "doc-cad/", page="doc-cad") 
    418388        self.assertEqual(2, len(list(response.context["object_doc_cad"]))) 
    419         self.assertEqual("doc-cad", response.context["current_page"]) 
    420389 
    421390    def test_doc_add_add_get(self): 
    422         response = self.client.get(self.base_url + "doc-cad/add/") 
    423         self.assertEqual(response.status_code, 200) 
    424         self.assertTrue(response.context["link_creation"]) 
     391        response = self.get(self.base_url + "doc-cad/add/", link=True) 
    425392        self.assertEqual("attach_doc", response.context["attach"][1]) 
    426393 
     
    430397        data = {"type" : doc1.type, "reference" : doc1.reference, 
    431398                "revision" : doc1.revision }  
    432         response = self.client.post(self.base_url + "doc-cad/add/", data, follow=True) 
    433         self.assertEqual(response.status_code, 200) 
     399        response = self.post(self.base_url + "doc-cad/add/", data) 
    434400        document = self.controller.get_attached_documents()[0].document 
    435401        self.assertEqual(doc1.object, document) 
     
    444410         
    445411    def test_user_attribute(self): 
    446         response = self.client.get(self.user_url + "attributes/") 
    447         self.assertEqual(response.status_code,  200) 
    448         self.failUnless(response.context["object_attributes"]) 
     412        response = self.get(self.user_url + "attributes/", page="attributes") 
    449413        attributes = dict((x.capitalize(), y) for (x,y) in  
    450414                          response.context["object_attributes"]) 
     
    453417 
    454418    def test_groups(self): 
    455         response = self.client.get(self.user_url + "groups/") 
    456         self.assertEqual(response.status_code,  200) 
     419        response = self.get(self.user_url + "groups/") 
    457420        # TODO 
    458421 
    459422    def test_part_doc_cads(self): 
    460         response = self.client.get(self.user_url + "parts-doc-cad/") 
    461         self.assertEqual(response.status_code,  200) 
     423        response = self.get(self.user_url + "parts-doc-cad/") 
    462424        # TODO 
    463425         
    464426    def test_history(self): 
    465         response = self.client.get(self.user_url + "history/") 
    466         self.assertEqual(response.status_code,  200) 
     427        response = self.get(self.user_url + "history/") 
    467428         
    468429    def test_navigate(self): 
    469         response = self.client.get(self.user_url + "navigate/") 
    470         self.assertEqual(response.status_code,  200) 
     430        response = self.get(self.user_url + "navigate/") 
    471431 
    472432    def test_sponsor_get(self): 
    473         response = self.client.get(self.user_url + "delegation/sponsor/") 
    474         self.assertEqual(response.status_code,  200) 
     433        response = self.get(self.user_url + "delegation/sponsor/") 
    475434        form = response.context["sponsor_form"] 
    476435        self.assertEquals(set(g.id for g in self.user.groupinfo_owner.all()), 
     
    481440                    username="loser", first_name="You", last_name="Lost", 
    482441                    email="you.lost@example.com", groups=[self.group.pk]) 
    483         response = self.client.post(self.user_url + "delegation/sponsor/", data, 
    484                 follow=True) 
    485         self.assertEqual(response.status_code,  200) 
     442        response = self.post(self.user_url + "delegation/sponsor/", data) 
    486443        user = User.objects.get(username=data["username"]) 
    487444        for attr in ("first_name", "last_name", "email"): 
     
    492449 
    493450    def test_modify_get(self): 
    494         response = self.client.get(self.user_url + "modify/") 
    495         self.assertEqual(response.status_code,  200) 
     451        response = self.get(self.user_url + "modify/") 
    496452        form = response.context["modification_form"] 
    497453        self.assertEqual(self.user.first_name, form.initial["first_name"]) 
     
    500456    def test_modify_post(self): 
    501457        data = {"last_name":"Snow", "email":"user@test.com", "first_name":"John"} 
    502         response = self.client.post(self.user_url + "modify/", data, 
    503                 follow=True) 
    504         self.assertEqual(response.status_code,  200) 
     458        response = self.post(self.user_url + "modify/", data) 
    505459        user = User.objects.get(username=self.user.username) 
    506460        self.assertEqual("Snow", user.last_name) 
    507461 
    508462    def test_password_get(self): 
    509         response = self.client.get(self.user_url + "password/") 
    510         self.assertEqual(response.status_code,  200) 
     463        response = self.get(self.user_url + "password/") 
    511464        self.assertTrue(response.context["modification_form"]) 
    512465 
     
    514467        data = dict(old_password="password", new_password1="pw", 
    515468                new_password2="pw") 
    516         response = self.client.post(self.user_url + "password/", data, follow=True) 
    517         self.assertEqual(response.status_code,  200) 
     469        response = self.post(self.user_url + "password/", data) 
    518470        self.user = User.objects.get(pk=self.user.pk) 
    519471        self.assertTrue(self.user.check_password("pw")) 
     
    522474        data = dict(old_password="error", new_password1="pw", 
    523475                new_password2="pw") 
    524         response = self.client.post(self.user_url + "password/", data, follow=True) 
     476        response = self.post(self.user_url + "password/", data) 
    525477        self.user = User.objects.get(pk=self.user.pk) 
    526478        self.assertTrue(self.user.check_password("password")) 
     
    528480 
    529481    def test_delegation_get(self): 
    530         response = self.client.get(self.user_url + "delegation/") 
    531         self.assertEqual(response.status_code,  200) 
     482        response = self.get(self.user_url + "delegation/") 
    532483         
    533484    def test_delegation_remove(self): 
     
    535486        link = self.controller.get_user_delegation_links()[0] 
    536487        data = {"link_id" : link.id } 
    537         response = self.client.post(self.user_url + "delegation/", data, follow=True) 
    538         self.assertEqual(response.status_code,  200) 
     488        response = self.post(self.user_url + "delegation/", data) 
    539489        self.assertFalse(self.controller.get_user_delegation_links()) 
    540490        
     
    542492        for role in ("owner", "notified"): 
    543493            url = self.user_url + "delegation/delegate/%s/" % role 
    544             response = self.client.get(url) 
    545             self.assertEqual(response.status_code,  200) 
     494            response = self.get(url, link=True, page="delegation") 
    546495            self.assertEqual(role, unicode(response.context["role"])) 
    547             self.assertTrue(response.context["link_creation"]) 
    548             self.assertEqual("delegation", response.context["current_page"]) 
    549496     
    550497    def test_delegate_sign_get(self): 
    551498        for level in ("all", "1", "2"): 
    552499            url = self.user_url + "delegation/delegate/sign/%s/" % str(level) 
    553             response = self.client.get(url) 
    554             self.assertEqual(response.status_code,  200) 
     500            response = self.get(url, link=True, page="delegation") 
    555501            role = unicode(response.context["role"]) 
    556502            self.assertTrue(role.startswith("signer")) 
    557503            self.assertTrue(level in role) 
    558             self.assertTrue(response.context["link_creation"]) 
    559             self.assertEqual("delegation", response.context["current_page"]) 
    560504 
    561505    def test_delegate_post(self): 
     
    563507        for role in ("owner", "notified"): 
    564508            url = self.user_url + "delegation/delegate/%s/" % role 
    565             response = self.client.post(url, data, follow=True) 
     509            response = self.post(url, data) 
    566510            DelegationLink.objects.get(role=role, delegator=self.user, 
    567511                    delegatee=self.brian) 
     
    571515        for level in xrange(1, 4): 
    572516            url = self.user_url + "delegation/delegate/sign/%d/" % level 
    573             response = self.client.post(url, data, follow=True) 
     517            response = self.post(url, data) 
    574518            role = level_to_sign_str(level - 1) 
    575519            DelegationLink.objects.get(role=role, 
     
    580524        data = { "type" : "User", "username": self.brian.username } 
    581525        url = self.user_url + "delegation/delegate/sign/all/" 
    582         response = self.client.post(url, data, follow=True) 
     526        response = self.post(url, data) 
    583527        for level in xrange(2): 
    584528            role = level_to_sign_str(level) 
     
    605549        query = self.get_query(request) 
    606550        t = type or request["type"] 
    607         response = self.client.get("/user/user/attributes/", 
     551        response = self.get("/user/user/attributes/", 
    608552                {"type" : t, "q" : query})  
    609         self.assertEqual(response.status_code, 200) 
    610553        results = list(response.context["results"]) 
    611554        results.sort(key=lambda r:r.object.pk) 
     
    613556 
    614557    def test_forms(self): 
    615         response = self.client.get("/user/user/attributes/") 
    616         self.assertEqual(response.status_code, 200) 
     558        response = self.get("/user/user/attributes/") 
    617559        # check if searchforms are present 
    618560        af = response.context["attributes_form"] 
     
    625567        query = self.get_query(data) 
    626568        for x in range(4): 
    627             response = self.client.get("/user/user/attributes/") 
    628             self.assertEqual(response.status_code, 200) 
     569            response = self.get("/user/user/attributes/") 
    629570            af = response.context["attributes_form"] 
    630571            self.assertEqual(af.data["q"], query) 
     
    731672     
    732673    def test_display_attributes2(self): 
    733         response = self.client.get(self.base_url + "attributes/") 
    734         self.assertEqual(response.status_code, 200) 
     674        response = self.get(self.base_url + "attributes/") 
    735675        self.failUnless(response.context["object_attributes"]) 
    736676        attributes = dict(response.context["object_attributes"]) 
     
    774714        data.update(type=self.TYPE, name="new_name") 
    775715        response = self.client.post(self.base_url + "modify/", data, follow=True) 
    776         self.assertEqual(response.status_code,  200) 
    777716        obj = get_all_plmobjects()[self.TYPE].objects.all()[0] 
    778717        self.assertEqual(obj.name, '') 
Note: See TracChangeset for help on using the changeset viewer.