def test_init_exceptions(): _state = State() with pytest.raises(ValueError): _state.add(create='c_test', update='c_update', read='c_read') with pytest.raises(TypeError): _state.add(test=['test']) # 'test' is not a keyword with pytest.raises(AttributeError): # read and read/write props must be disjoint _state.add(update=['test'], read=['test']) s = State(update=['update'], read=['read'], create=['create']) with pytest.raises(AttributeError): # test is not a valid attribute of Field outside what get_names expects s.get_names('test') with pytest.raises(ValueError): _state.add(read=read, update=update, create=create) _state.add(create=['read']) # already exists
def test_init_exceptions(): state = State() with pytest.raises(ValueError): state.add(create="c_test", update="c_update", read="c_read") with pytest.raises(TypeError): state.add(test=["test"]) # 'test' is not a keyword with pytest.raises(AttributeError): # read and read/write props must be disjoint state.add(update=["test"], read=["test"]) s = State(update=["update"], read=["read"], create=["create"]) with pytest.raises(AttributeError): # test is not a valid attribute of Field outside what get_names expects s.get_names("test") with pytest.raises(ValueError): # no Field object with this name s.remove("xyz") with pytest.raises(ValueError): state.add(read=read, update=update, create=create) state.add(create=["read"]) # already exists
def test_state_get_names(): """ tests get_names function to get the names based on attributes """ _state = State(read=read, update=update, create=create) r_ = _state.get_names('read') u_ = _state.get_names('update') c_ = _state.get_names('create') r_.sort() u_.sort() c_.sort() assert r_ == read assert u_ == update assert c_ == create
def test_state_get_names(): """ tests get_names function to get the names based on attributes """ state = State(read=read, update=update, create=create) r_ = state.get_names("read") u_ = state.get_names("update") c_ = state.get_names("create") r_.sort() u_.sort() c_.sort() assert r_ == read assert u_ == update assert c_ == create
def test_state_get_names(self): """ tests get_names function to get the names based on attributes """ _state = State(read=read, update=update, save=save) r_ = _state.get_names('read') r_.sort() u_ = _state.get_names('update') u_.sort() c_ = _state.get_names('save') c_.sort() assert r_ == read assert u_ == update assert c_ == save
def test_init_exceptions(): _state = State() with pytest.raises(TypeError): _state.add(test=['test']) # 'test' is not a keyword with pytest.raises(AttributeError): # read and read/write props must be disjoint _state.add(update=['test'], read=['test']) s = State(update=['update'], read=['read'], save=['save']) with pytest.raises(AttributeError): # test is not a valid attribute of Field outside what get_names expects s.get_names('test') with pytest.raises(ValueError): _state.add(read=read, update=update, save=save) _state.add(save=['read']) # already exists
def test_state_get_names_list(self): """ tests get_names function to get the names based on attributes """ _state = State(read=read, update=update, save=save) check = [] check.extend(read) check.extend(save) check.sort() l_ = _state.get_names(['read', 'save']) l_.sort() assert l_ == check
def test_state_get_names_list(): """ tests get_names function to get the names based on attributes """ state = State(read=read, update=update, create=create) check = [] check.extend(read) check.extend(create) check.sort() l_ = state.get_names(["read", "create"]) l_.sort() assert l_ == check