Esempio n. 1
0
 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'}
Esempio n. 2
0
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
Esempio n. 3
0
 def test_set_journal_index(self, model: Model):
     model.set_journal_index(1)
     assert model._journal_index == 1
Esempio n. 4
0
 def test_set_name_index(self, model: Model):
     model.set_name_index(1)
     assert model._name_index == 1
Esempio n. 5
0
 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']
Esempio n. 6
0
 def test_pin(self, model: Model):
     assert model.pin == ''
     model._pin = '1234'
     assert model.pin == '1234'
Esempio n. 7
0
 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'
Esempio n. 8
0
 def test_journal(self, model: Model):
     model._journals = ['', 'c', 'd']
     assert model.journal is None
     model._journal_index = 1
     assert model.journal == 'c'
Esempio n. 9
0
 def test_journals(self, model: Model):
     assert model.journals == []
     model._journals = ['', 'c', 'd']
     assert model.journals == ['', 'c', 'd']
Esempio n. 10
0
 def test_name(self, model: Model):
     assert model.name is None
     model._name_index = 1
     model._names = ['', 'a', 'b']
     assert model.name == 'a'
Esempio n. 11
0
 def test_names(self, model: Model):
     assert model.names == []
     model._names = ['', 'a', 'b']
     assert model.names == ['', 'a', 'b']
Esempio n. 12
0
def model():
    return Model()
Esempio n. 13
0
 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()
Esempio n. 14
0
 def test_set_pin(self, model: Model):
     model.set_pin('1234')
     assert model.pin == '1234'