예제 #1
0
 def test_query_params_sorted_order(self):
     self.assertEqual(
         generate_base_string_query(dict(b=[8, 2, 4], a=1), {}),
         b("a=1&b=2&b=4&b=8"))
     qs = generate_base_string_query(
         dict(a=5, b=6, c=["w", "a", "t", "e", "r"]), {})
     self.assertEqual(qs, b("a=5&b=6&c=a&c=e&c=r&c=t&c=w"))
예제 #2
0
 def test_simplegeo_example(self):
     self.assertNotEqual(
         generate_base_string_query(self.simplegeo_example_url_query_params,
                                    self.simplegeo_example_oauth_params),
         self.simplegeo_example_wrong_order_query_string)
     self.assertEqual(
         generate_base_string_query(self.simplegeo_example_url_query_params,
                                    self.simplegeo_example_oauth_params),
         self.simplegeo_example_correct_query_string)
예제 #3
0
    def test_oauth_signature_and_realm_are_excluded_properly(self):
        qs = generate_base_string_query({
            OAUTH_PARAM_SIGNATURE: "something"
            },
            self.specification_example_oauth_params
        )
        self.assertTrue(b("oauth_signature=") not in qs)
        self.assertTrue(b("realm=") not in qs)

        self.assertTrue(
            generate_base_string_query(dict(realm="something"), dict()),
            b("realm=something")
        )
예제 #4
0
 def test_no_query_params_returns_empty_string(self):
     self.assertEqual(generate_base_string_query({}, {}), b(""))
     self.assertEqual(generate_base_string_query(None, None), b(""))
예제 #5
0
 def test_non_string_single_value(self):
     self.assertEqual(generate_base_string_query(dict(a=5), None), b("a=5"))
     self.assertEqual(
         generate_base_string_query(dict(aFlag=True, bFlag=False), None),
         b("aFlag=True&bFlag=False")
     )
예제 #6
0
 def test_multiple_values(self):
     self.assertEqual(
         generate_base_string_query(dict(a=[5, 8]), {}),
         b("a=5&a=8")
     )
예제 #7
0
 def test_oauth_specification_example(self):
     self.assertEqual(generate_base_string_query(
         self.specification_url_query_params,
         self.specification_example_oauth_params),
                  self.specification_example_query_string)