예제 #1
0
    def test_services_remains_empty_on_failed_http(self, MockHttp):
        MockHttp.return_value.request.return_value = ({'status': 500}, "")

        client = Embedly(self.key)
        client.get_services()

        self.assertFalse(client.services)
        self.assertTrue(MockHttp.return_value.request.called)
예제 #2
0
    def test_services_remains_empty_on_failed_http(self, MockHttp):
        MockHttp.return_value.request.return_value = ({'status': 500}, "")

        client = Embedly(self.key)
        client.get_services()

        self.assertFalse(client.services)
        self.assertTrue(MockHttp.return_value.request.called)
예제 #3
0
    def test_get_services_retrieves_data_and_builds_regex(self):
        client = Embedly(self.key)
        client.get_services()

        self.assertGreater(len(client.services), 0)
        self.assertTrue(client.regex.match('http://yfrog.com/h22eu4j'))
예제 #4
0
    def test_services_can_be_manually_configured(self):
        client = Embedly(self.key)
        client.services = ['nothing', 'like', 'real', 'response', 'data']

        self.assertTrue('nothing' in client.get_services())
        self.assertEqual(len(client.get_services()), 5)
예제 #5
0
    def test_get_services_retrieves_data_and_builds_regex(self):
        client = Embedly(self.key)
        client.get_services()

        self.assertGreater(len(client.services), 0)
        self.assertTrue(client.regex.match('http://yfrog.com/h22eu4j'))
예제 #6
0
    def test_services_can_be_manually_configured(self):
        client = Embedly(self.key)
        client.services = ['nothing', 'like', 'real', 'response', 'data']

        self.assertTrue('nothing' in client.get_services())
        self.assertEqual(len(client.get_services()), 5)