Ejemplo n.º 1
0
    def test_query_key_with_language(self):
        self.client = Client(application_key='')
        self.client.api_language = 'de'
        query = Query(self.client, self.resource)
        key = query.query_key(1)
        expected = '{}:1:de'.format(self.resource_name)
        self.assertEqual(key, expected)

        # Unsetting the language should also remove it from the key
        self.client.api_language = None
        key = query.query_key(1)
        expected = '{}:1'.format(self.resource_name)
        self.assertEqual(key, expected)
Ejemplo n.º 2
0
    def test_query_key_with_language(self):
        self.client = Client(application_key='')
        self.client.api_language = 'de'
        query = Query(self.client, self.resource)
        key = query.query_key(1)
        expected = '{}:1:de'.format(self.resource_name)
        self.assertEqual(key, expected)

        # Unsetting the language should also remove it from the key
        self.client.api_language = None
        key = query.query_key(1)
        expected = '{}:1'.format(self.resource_name)
        self.assertEqual(key, expected)
Ejemplo n.º 3
0
 def test_query_key_no_resource_id(self):
     query = Query(self.client, self.resource)
     key = query.query_key()
     self.assertEqual(key, self.resource_name)
Ejemplo n.º 4
0
 def test_query_key_with_variation_id(self):
     query = Query(self.client, self.resource)
     key = query.query_key(1, 2)
     expected = '{}:1:2:test'.format(self.resource_name)
     self.assertEqual(key, expected)
Ejemplo n.º 5
0
 def test_query_key_no_resource_id(self):
     query = Query(self.client, self.resource)
     key = query.query_key()
     self.assertEqual(key, self.resource_name)
Ejemplo n.º 6
0
 def test_query_key_with_variation_id(self):
     query = Query(self.client, self.resource)
     key = query.query_key(1, 2)
     expected = '{}:1:2:test'.format(self.resource_name)
     self.assertEqual(key, expected)