Exemplo n.º 1
0
    def test_response_must_be_a_response_object(self):
        e = Embed()
        with self.assertRaises(InvalidResponseError):
            e.response = None

        with self.assertRaises(InvalidResponseError):
            e.response = "this should break"
Exemplo n.º 2
0
 def test_wont_assign_duplicate_response(self):
     e = Embed()
     r1 = self.response_cls(dict(a=1))
     r2 = self.backend.wrap_response_data(dict(a=1))
     e.response = r1
     self.assertEqual(id(r1), id(e.response))
     e.response = r2
     self.assertEqual(id(r1), id(e.response))
Exemplo n.º 3
0
    def test_changing_url_clears_response_data(self):
        e = Embed(url=self.url, backend=self.backend)
        e.response = self.response
        self.assertIsNotNone(e.response)

        e.url = self.new_url
        self.expect_empty_response_data(e)
Exemplo n.º 4
0
 def test_un_fresh_response_doesnt_set_properties(self):
     e = Embed()
     self.response._fresh = False
     e.response = self.response
     self.assertIsNone(e.type)
     self.assertIsNone(e.provider)
     self.assertEqual(e.response_cache, {})