Ejemplo n.º 1
0
    def test_fetch_list_fails(self):
        self.run_api_call.side_effect = Exception("DEADBEEF")

        with self.assertRaises(api_interface.FetchInformationFailed) as cm:
            api_interface.fetch_plans(Mock())

        the_exception = cm.exception
        self.assertEqual(str(the_exception), "DEADBEEF")
Ejemplo n.º 2
0
    def test_fetch_list_fails(self):
        self.run_api_call.side_effect = Exception("DEADBEEF")

        with self.assertRaises(api_interface.FetchInformationFailed) as cm:
            api_interface.fetch_plans(Mock())

        the_exception = cm.exception
        self.assertEqual(str(the_exception), "DEADBEEF")
Ejemplo n.º 3
0
    def test_fetch_plans_empty_fails(self):
        ret_val = []

        self.run_api_call.return_value = ret_val

        with self.assertRaises(api_interface.FetchInformationFailed) as cm:
            result = api_interface.fetch_plans(Mock())

        the_exception = cm.exception
        self.assertEqual(str(the_exception), api_interface.NO_PLANS)
Ejemplo n.º 4
0
    def test_fetch_plans_empty_fails(self):
        ret_val = []

        self.run_api_call.return_value = ret_val

        with self.assertRaises(api_interface.FetchInformationFailed) as cm:
            result = api_interface.fetch_plans(Mock())

        the_exception = cm.exception
        self.assertEqual(str(the_exception), api_interface.NO_PLANS)
Ejemplo n.º 5
0
    def test_fetch_list_succeeds(self):
        ret_val = [{'group_id': sentinel.group_id1,
                    'storage_gigs' : sentinel.storage_gigs1,
                    },
                   {'group_id': sentinel.group_id2,
                    'storage_gigs' : sentinel.storage_gigs2
                    }]

        self.run_api_call.return_value = ret_val

        result = api_interface.fetch_plans(Mock())
        self.assertEqual(result, ret_val)
Ejemplo n.º 6
0
    def test_fetch_list_succeeds(self):
        ret_val = [{
            'group_id': sentinel.group_id1,
            'storage_gigs': sentinel.storage_gigs1,
        }, {
            'group_id': sentinel.group_id2,
            'storage_gigs': sentinel.storage_gigs2
        }]

        self.run_api_call.return_value = ret_val

        result = api_interface.fetch_plans(Mock())
        self.assertEqual(result, ret_val)