예제 #1
0
파일: test_track.py 프로젝트: Smiledir/gets
    def do_test_update_track(self, fields):
        gt.do_get("test/resetDatabase.php");
        self.sign_in()

        def_values = {
                "description" : "test description 1",
                "url" : "http://example.com/1",
                "name" : "test track 1",

                "category_id" : "1",
                "lang" : "ru_RU",
                "photoUrl" : "http://example.com/1.png"
                }
        
        values = {
                "description" : "test track desc 1",
                "url" : "http://example.com/11",
                "name" : "test track 2",

                "category_id" : "1",
                "lang" : "en_GB",
                "photoUrl" : "http://example.com/2.png"
                }

        res = gt.request("createTrack.php", gt.make_request(
                ("auth_token", self.token),
                ("name", "test track 1"),

                ("description", "test description 1"),
                ("url", "http://example.com/1"),
                ("category_id", "1"),
                ("lang", "ru_RU"),
                ("photoUrl", "http://example.com/1.png")))

        track_id = res.find(".//track_id").text

        parm = []
        parm.append( ("auth_token", self.token) )
        parm.append( ("track_id", track_id) )
        
        for field in fields:
            parm.append( (field, values[field]) )

        res = gt.request("updateTrack.php", gt.make_request(*parm))
        self.assert_code(res, 0)

        res = self.load_private_tracks()

        for key in values:
            if (key in fields):
                ex_value = values[key]
            else:
                ex_value = def_values[key]

            if key == "name":
                key = "hname"
            
            self.assertEqual(res.find(".//tracks/track/" + key).text, ex_value, "For key " + key + " " + str(fields))
예제 #2
0
    def do_test_update_track(self, fields):
        gt.do_get("test/resetDatabase.php")
        self.sign_in()

        def_values = {
            "description": "test description 1",
            "url": "http://example.com/1",
            "name": "test track 1",
            "category_id": "1",
            "lang": "ru_RU",
            "photoUrl": "http://example.com/1.png"
        }

        values = {
            "description": "test track desc 1",
            "url": "http://example.com/11",
            "name": "test track 2",
            "category_id": "1",
            "lang": "en_GB",
            "photoUrl": "http://example.com/2.png"
        }

        res = gt.request(
            "createTrack.php",
            gt.make_request(
                ("auth_token", self.token), ("name", "test track 1"),
                ("description", "test description 1"),
                ("url", "http://example.com/1"), ("category_id", "1"),
                ("lang", "ru_RU"), ("photoUrl", "http://example.com/1.png")))

        track_id = res.find(".//track_id").text

        parm = []
        parm.append(("auth_token", self.token))
        parm.append(("track_id", track_id))

        for field in fields:
            parm.append((field, values[field]))

        res = gt.request("updateTrack.php", gt.make_request(*parm))
        self.assert_code(res, 0)

        res = self.load_private_tracks()

        for key in values:
            if (key in fields):
                ex_value = values[key]
            else:
                ex_value = def_values[key]

            if key == "name":
                key = "hname"

            self.assertEqual(
                res.find(".//tracks/track/" + key).text, ex_value,
                "For key " + key + " " + str(fields))
예제 #3
0
파일: test_track.py 프로젝트: Smiledir/gets
 def sign_in(self):
     self.token = gt.do_get("test/createTestAccount.php")
     return self.token
예제 #4
0
파일: test_track.py 프로젝트: Smiledir/gets
    def setUp(self):
        self.token = None

        gt.do_get("test/resetDatabase.php");
        pass
예제 #5
0
 def sign_in(self):
     self.token = gt.do_get("test/createTestAccount.php")
     return self.token
예제 #6
0
    def setUp(self):
        self.token = None

        gt.do_get("test/resetDatabase.php")
        pass