def test_set_names(self, model: Model, mock_ttg: Mock): model._journals = ['', 'c', 'd'] model._journal_mapping = {'c': 'e', 'd': 'f'} model._journal_index = 1 model.set_names() assert model.names == ['', 'a', 'b'] assert model._name_mapping == {'a': '1', 'b': '2'}
def model(mocker: MockFixture, mock_journals) -> Model: model = Model() mock_set_names = mocker.patch.object(model, 'set_names') def set_names(*args, **kwargs): model._names = ['', 'Vincent'] model._name_mapping = {'Vincent': '1234'} mock_set_names.side_effect = set_names return model
def test_set_journal_index(self, model: Model): model.set_journal_index(1) assert model._journal_index == 1
def test_set_name_index(self, model: Model): model.set_name_index(1) assert model._name_index == 1
def test_set_journals(self, model: Model, mock_journals: Mock): model.set_journals() assert model._journal_mapping == {'w': 'x', 'y': 'z'} assert model.journals == ['', 'w', 'y']
def test_pin(self, model: Model): assert model.pin == '' model._pin = '1234' assert model.pin == '1234'
def test_sheet_id(self, model: Model): model._journals = ['', 'c', 'd'] model._journal_mapping = {'c': 'e', 'd': 'f'} assert model.sheet_id is None model._journal_index = 1 assert model.sheet_id == 'e'
def test_journal(self, model: Model): model._journals = ['', 'c', 'd'] assert model.journal is None model._journal_index = 1 assert model.journal == 'c'
def test_journals(self, model: Model): assert model.journals == [] model._journals = ['', 'c', 'd'] assert model.journals == ['', 'c', 'd']
def test_name(self, model: Model): assert model.name is None model._name_index = 1 model._names = ['', 'a', 'b'] assert model.name == 'a'
def test_names(self, model: Model): assert model.names == [] model._names = ['', 'a', 'b'] assert model.names == ['', 'a', 'b']
def model(): return Model()
def test_login(self, model: Model): assert not model.login() model._names = ['', 'a'] model._name_mapping = {'a': '1234'} model.set_name_index(1) model.set_pin('1234') assert model.login() model.set_pin('5678') assert not model.login()
def test_set_pin(self, model: Model): model.set_pin('1234') assert model.pin == '1234'