Beispiel #1
0
    def testUploadChronicle(self):
        c = Client()
        self.assertTrue(c.login(username='******', password='******'))
        
        loadfn = 'chronicle_camarilla_five_xml.gex'
        for app_fixture in get_fixture_path_gen():
            if os.path.exists(os.path.join(app_fixture, loadfn)):
                with open(os.path.join(app_fixture, loadfn), 'r') as f:
                    c.post("/characters/upload_sheet/",
                           {'title': 'whocares',
                            'file': f,
                            'action': 'upload'})
        response = c.get("/characters/list_sheet/carma-adam-st-charles/")
        self.assertEqual(response.status_code, 200, "Can't access XML sheets")

        c = Client()
        self.assertTrue(c.login(username='******', password='******'))
        loadfn = 'chronicle_camarilla_five_bin.gex'
        for app_fixture in get_fixture_path_gen():
            if os.path.exists(os.path.join(app_fixture, loadfn)):
                with open(os.path.join(app_fixture, loadfn), 'rb') as f:
                    c.post("/characters/upload_sheet/",
                           {'title': 'whocares',
                            'file': f,
                            'action': 'upload'})
        response = c.get("/characters/list_sheet/kritn-adam-st-charles/")
        self.assertEqual(response.status_code, 200, "Can't access binary sheets")

        xlist = User.objects.get(username__exact='Carma').personal_characters.order_by('name')
        blist = User.objects.get(username__exact='Kritn').personal_characters.order_by('name')
        self.assertNotEqual(len(xlist), 0)
        self.assertNotEqual(len(blist), 0)
        for xv, bv in izip(xlist, blist):
            compare_vampire_sheets(self, xv.vampiresheet, bv.vampiresheet)
Beispiel #2
0
    def uploadForUser(self, fn, username, password):
        c = Client()
        self.assertTrue(c.login(username=username, password=password))

        loadfn = fn
        for app_fixture in get_fixture_path_gen():
            if os.path.exists(os.path.join(app_fixture, loadfn)):
                with open(os.path.join(app_fixture, loadfn), 'r') as f:
                    c.post("/characters/upload_sheet/",
                           {'title': 'whocares',
                            'file': f,
                            'action': 'upload'})
        return c
Beispiel #3
0
    def testNewSheetView(self):
        loadfn = 'adamstcharles.gex'
        c = Client()
        self.assertTrue(c.login(username='******', password='******'))
        for app_fixture in get_fixture_path_gen():
            if os.path.exists(os.path.join(app_fixture, loadfn)):
                with open(os.path.join(app_fixture, loadfn), 'r') as f:
                    c.post("/characters/upload_sheet/",
                           {'title': 'whocares',
                            'file': f,
                            'action': 'upload'})
        response = c.get("/characters/list_sheet/perpet-adam-st-charles/")
        self.assertEqual(response.status_code, 200, "perpet should be able to access his sheets")

        self.assertTrue(self.client.login(username='******', password='******'))
        response = self.client.get("/characters/list_sheet/perpet-adam-st-charles/")
        self.assertEqual(response.status_code, 403, "lorien should not be able to access perpet's sheets")