def setUp(self):
     self.site = Site.objects.get_current()
     self.bing_code = 'E234232G123413DF234324'
     self.bing_benefactor = SearchEngineTools(site=self.site
                                         ,service='bing'
                                         ,service_code=self.bing_code)
     self.bing_benefactor.save()
class SearchEngineToolsrModelsTests(TestCase):
    def setUp(self):
        self.site = Site.objects.get_current()
        self.bing_code = 'E234232G123413DF234324'
        self.bing_benefactor = SearchEngineTools(site=self.site
                                            ,service='bing'
                                            ,service_code=self.bing_code)
        self.bing_benefactor.save()

    def tearDown(self):
        self.bing_benefactor.delete()
        
    def test_get_code_sould_return_the_service_code(self):
        bing_code = SearchEngineTools.objects.get_code('bing', self.site)
        self.assertEqual(bing_code, self.bing_code)
        
    def test_get_code_should_return_false_is_the_is_no_service(self):
        false_code = SearchEngineTools.objects.get_code('google_analytic', self.site)
        self.assertFalse(false_code)