def setUp(self): Account.default_adapter = MockAdapter self.search = Search( Account(account_id="100", public_key="xxx", private_key="yyy"), { 'search_id': 200, 'deleted_at': None, 'last_run_at': datetime.now().strftime(SERIALIZED_DATETIME_FORMAT) })
def test_can_save_a_search(self): srch = Search(self.search.account, { 'name': "Test Search", 'criteria': ["group", "eq", "Test Group"] }) MockAdapter.expected = 1024 result = srch.save() self.assertIsNone(result) self.assertEqual(srch.account.adapter.called, 1) self.assertEqual(srch.account.adapter.call, ('POST', '/searches', { 'name': "Test Search", 'criteria': ["group", "eq", "Test Group"] })) self.assertEqual(1024, srch['search_id'])
def setUp(self): Account.default_adapter = MockAdapter self.members = Search( Account(account_id="100", public_key="xxx", private_key="yyy"), { 'search_id': 1024 }).members