def dtesddt_show_items(self): httpretty.register_uri(httpretty.GET, FILES_URL, body=json.dumps({ 'items': SAMPLE_ITEMS }), content_type='application/json'); Drive.show_items('c') self.assertEquals(len(wf._items), 21) wf._items = []
def test_show_items_no_internet(self): wf._items = [] Passwords.clear() Drive.clear_cache() wf.cache_data('drive_error', 'ConnectionError') httpretty.register_uri(httpretty.GET, FILES_URL, body=exceptionCallback, content_type='text/html'); self.assertEquals(len(wf._items), 0) Drive.show_items('c') self.assertEquals(len(wf._items), 1) self.assertEquals(wf._items[0].title, ERRORS['ConnectionError']['title'])
def test_show_items_no_access_token(self): wf._items = [] Drive.clear_cache() Passwords.clear() httpretty.register_uri(httpretty.GET, FILES_URL, body=json.dumps({ 'items': SAMPLE_ITEMS }), content_type='application/json'); self.assertEquals(len(wf._items), 0) Drive.show_items('c') self.assertEquals(len(wf._items), 1) self.assertEquals(wf._items[0].title, ERRORS['PasswordNotFound']['title'])
def xtest_show_items_time(self): wf._items = [] start_time = time.time() * 1000 Drive.show_items('c') self.assertEquals(time.time() * 1000 - start_time, 0)